add util method

This commit is contained in:
Renaud Pawlak 2020-10-30 14:15:26 +01:00
parent 5da9f84fa9
commit 5ce8b07fb4

View File

@ -1260,12 +1260,22 @@ public class JSweetContext extends Context {
} }
/** /**
* Tells if the given type is a Java interface. * Tells if the given type is an interface.
*/ */
public boolean isInterface(TypeSymbol typeSymbol) { public boolean isInterface(TypeSymbol typeSymbol) {
return (typeSymbol.type.isInterface() || hasAnnotationType(typeSymbol, JSweetConfig.ANNOTATION_INTERFACE)); return (typeSymbol.type.isInterface() || hasAnnotationType(typeSymbol, JSweetConfig.ANNOTATION_INTERFACE));
} }
/**
* Tells if the given type is an interface.
*/
public boolean isInterface(Element element) {
if (element instanceof TypeSymbol) {
return isInterface((TypeSymbol)element);
}
return false;
}
/** /**
* Tells if the given symbol is annotated with one of the given annotation * Tells if the given symbol is annotated with one of the given annotation
* types. * types.