Class ElementInfo
- Direct Known Subclasses:
AccessibleInfo,ClassInfo,ParameterInfo
This class provides the foundation for all reflection info wrappers (classes, methods, fields, constructors, etc.) by providing common functionality for checking Java language modifiers and element flags. Subclasses extend this to provide specific functionality for their element type.
Features:
- Modifier checking - check for public, private, protected, static, final, etc.
- Flag checking - check for element flags using
ElementFlag - Combined flag checking - check for multiple flags at once
- Extensible - subclasses can add element-specific flag checks
Use Cases:
- Checking modifiers on reflection elements
- Filtering elements by flags
- Building frameworks that need to analyze element characteristics
Usage:
See Also:
ElementFlag- Element flags enumerationClassInfo- Class introspectionMethodInfo- Method introspectionFieldInfo- Field introspection- Reflection Package
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected <A extends Annotation>
AnnotationInfo<A>ai(Annotatable on, A value) intReturns the Java language modifiers for this element.booleanis(ElementFlag flag) Returnstrue if the specified flag is applicable to this element.booleanReturnstrue if this element is abstract.booleanisAll(ElementFlag... flags) Returnstrue if all specified flags are applicable to this element.booleanisAny(ElementFlag... flags) Returnstrue if any of the specified flags are applicable to this element.booleanisFinal()Returnstrue if this element is final.booleanReturnstrue if this element is an interface.booleanisNative()Returnstrue if this element is native.booleanReturnstrue if this element is not abstract.booleanReturnstrue if this element is not final.booleanReturnstrue if this element is not an interface.booleanReturnstrue if this element is not native.booleanReturnstrue if this element is not private.booleanReturnstrue if this element is not protected.booleanReturnstrue if this element is not public.booleanReturnstrue if this element is not static.booleanReturnstrue if this element is not synchronized.booleanReturnstrue if this element is not transient.booleanReturnstrue if this element is not volatile.booleanReturnstrue if this element is private.booleanReturnstrue if this element is protected.booleanisPublic()Returnstrue if this element is public.booleanisStatic()Returnstrue if this element is static.booleanReturnstrue if this element is synchronized.booleanReturnstrue if this element is transient.booleanReturnstrue if this element is volatile.
-
Constructor Details
-
ElementInfo
Constructor.- Parameters:
modifiers- The Java modifiers for this element.
-
-
Method Details
-
getModifiers
Returns the Java language modifiers for this element.- Returns:
- The Java language modifiers for this element.
-
is
Returnstrue if the specified flag is applicable to this element.Subclasses should override this method and call
super.is(flag)to handle common modifier flags, then handle their own specific flags.- Parameters:
flag- The flag to test for.- Returns:
true if the specified flag is applicable to this element.
-
isAbstract
Returnstrue if this element is abstract.- Returns:
true if this element is abstract.
-
isAll
Returnstrue if all specified flags are applicable to this element.Subclasses should override this method and call
super.isAll(flags)to handle common modifier flags, then handle their own specific flags.- Parameters:
flags- The flags to test for.- Returns:
true if all specified flags are applicable to this element.
-
isAny
Returnstrue if any of the specified flags are applicable to this element.Subclasses should override this method and call
super.isAny(flags)to handle common modifier flags, then handle their own specific flags.- Parameters:
flags- The flags to test for.- Returns:
true if any of the specified flags are applicable to this element.
-
isFinal
Returnstrue if this element is final.- Returns:
true if this element is final.
-
isInterface
Returnstrue if this element is an interface.- Returns:
true if this element is an interface.
-
isNative
Returnstrue if this element is native.- Returns:
true if this element is native.
-
isNotAbstract
Returnstrue if this element is not abstract.- Returns:
true if this element is not abstract.
-
isNotFinal
Returnstrue if this element is not final.- Returns:
true if this element is not final.
-
isNotInterface
Returnstrue if this element is not an interface.- Returns:
true if this element is not an interface.
-
isNotNative
Returnstrue if this element is not native.- Returns:
true if this element is not native.
-
isNotPrivate
Returnstrue if this element is not private.- Returns:
true if this element is not private.
-
isNotProtected
Returnstrue if this element is not protected.- Returns:
true if this element is not protected.
-
isNotPublic
Returnstrue if this element is not public.- Returns:
true if this element is not public.
-
isNotStatic
Returnstrue if this element is not static.- Returns:
true if this element is not static.
-
isNotSynchronized
Returnstrue if this element is not synchronized.- Returns:
true if this element is not synchronized.
-
isNotTransient
Returnstrue if this element is not transient.- Returns:
true if this element is not transient.
-
isNotVolatile
Returnstrue if this element is not volatile.- Returns:
true if this element is not volatile.
-
isPrivate
Returnstrue if this element is private.- Returns:
true if this element is private.
-
isProtected
Returnstrue if this element is protected.- Returns:
true if this element is protected.
-
isPublic
Returnstrue if this element is public.- Returns:
true if this element is public.
-
isStatic
Returnstrue if this element is static.- Returns:
true if this element is static.
-
isSynchronized
Returnstrue if this element is synchronized.- Returns:
true if this element is synchronized.
-
isTransient
Returnstrue if this element is transient.- Returns:
true if this element is transient.
-
isVolatile
Returnstrue if this element is volatile.- Returns:
true if this element is volatile.
-
ai
-