public final class FeatureUtils
extends java.lang.Object
Modifier and Type | Method and Description |
---|---|
static java.lang.reflect.Method |
findMethod(java.lang.Class<?> type,
java.lang.String name,
java.lang.Class<java.lang.Object>... args) |
static <T extends java.lang.annotation.Annotation> |
getAnnotatedAnnotation(java.lang.Class<?> type,
java.lang.Class<T> annotation) |
static <T extends java.lang.annotation.Annotation> |
getAnnotation(java.lang.Class<?> type,
java.lang.Class<T> annotation) |
static java.lang.String |
getInstallerExtName(java.lang.Class<? extends FeatureInstaller> installer)
Utility call to prettify logs.
|
static <T> java.lang.Class<T> |
getInstanceClass(T object)
Used to get correct object type even if it's guice proxy.
|
static boolean |
hasAnnotatedAnnotation(java.lang.Class<?> type,
java.lang.Class<? extends java.lang.annotation.Annotation> annotation) |
static boolean |
hasAnnotation(java.lang.Class<?> type,
java.lang.Class<? extends java.lang.annotation.Annotation> annotation) |
static <T> T |
invokeMethod(java.lang.reflect.Method method,
java.lang.Object instance,
java.lang.Object... args) |
static boolean |
is(java.lang.Class<?> type,
java.lang.Class<?> required) |
public static boolean hasAnnotation(java.lang.Class<?> type, java.lang.Class<? extends java.lang.annotation.Annotation> annotation)
type
- type to checkannotation
- annotation to findpublic static boolean hasAnnotatedAnnotation(java.lang.Class<?> type, java.lang.Class<? extends java.lang.annotation.Annotation> annotation)
type
- type to checkannotation
- annotation to findpublic static <T extends java.lang.annotation.Annotation> T getAnnotation(java.lang.Class<?> type, java.lang.Class<T> annotation)
T
- annotation typetype
- type to examineannotation
- annotation to searchpublic static <T extends java.lang.annotation.Annotation> java.lang.annotation.Annotation getAnnotatedAnnotation(java.lang.Class<?> type, java.lang.Class<T> annotation)
T
- annotation typetype
- type to examineannotation
- annotation which must be found on target annotationpublic static boolean is(java.lang.Class<?> type, java.lang.Class<?> required)
type
- type to checkrequired
- required marker superclass or interfacepublic static java.lang.String getInstallerExtName(java.lang.Class<? extends FeatureInstaller> installer)
installer
- installer class@SafeVarargs public static java.lang.reflect.Method findMethod(java.lang.Class<?> type, java.lang.String name, java.lang.Class<java.lang.Object>... args)
type
- examining typename
- method nameargs
- method argument typespublic static <T> T invokeMethod(java.lang.reflect.Method method, java.lang.Object instance, java.lang.Object... args)
T
- expected type of execution resultmethod
- method to callinstance
- object instance to call method onargs
- optional argumentspublic static <T> java.lang.Class<T> getInstanceClass(T object)
T
- object typeobject
- object to get class of