AI-generated Key Takeaways
-
The
Member
interface in Java reflection provides information about a single member (field, method, or constructor) of a class. -
It includes methods to retrieve the declaring class, modifiers, name, and whether the member is synthetic.
-
Member
has two constants,DECLARED
andPUBLIC
, used for filtering members. -
Known indirect subclasses of
Member
includeConstructor
,Executable
,Field
, andMethod
, offering more specific functionalities. -
You can use
Member
to access and manipulate the structure of classes at runtime.
Known Indirect Subclasses
|
Member is an interface that reflects identifying information about a single member (a field or a method) or a constructor.
See Also
Constant Summary
int | DECLARED | Identifies the set of declared members of a class or interface. |
int | PUBLIC | Identifies the set of all public members of a class or interface, including inherited members. |
Public Method Summary
abstract Class<?> |
getDeclaringClass()
Returns the Class object representing the class or interface
that declares the member or constructor represented by this Member.
|
abstract int |
getModifiers()
Returns the Java language modifiers for the member or
constructor represented by this Member, as an integer.
|
abstract String |
getName()
Returns the simple name of the underlying member or constructor
represented by this Member.
|
abstract boolean |
isSynthetic()
Returns
true if this member was introduced by
the compiler; returns false otherwise. |
Constants
public static final int DECLARED
Identifies the set of declared members of a class or interface. Inherited members are not included.
public static final int PUBLIC
Identifies the set of all public members of a class or interface, including inherited members.
Public Methods
public abstract Class<?> getDeclaringClass ()
Returns the Class object representing the class or interface that declares the member or constructor represented by this Member.
Returns
- an object representing the declaring class of the underlying member
public abstract int getModifiers ()
Returns the Java language modifiers for the member or constructor represented by this Member, as an integer. The Modifier class should be used to decode the modifiers in the integer.
Returns
- the Java language modifiers for the underlying member
See Also
public abstract String getName ()
Returns the simple name of the underlying member or constructor represented by this Member.
Returns
- the simple name of the underlying member
public abstract boolean isSynthetic ()
Returns true
if this member was introduced by
the compiler; returns false
otherwise.
Returns
- true if and only if this member was introduced by the compiler.