Member
Stay organized with collections
Save and categorize content based on your preferences.
Known Indirect Subclasses
Constructor<T> |
Constructor provides information about, and access to, a single
constructor for a class. |
Executable |
A shared superclass for the common functionality of Method
and Constructor . |
Field |
A Field provides information about, and dynamic access to, a
single field of a class or an interface. |
Method |
A Method provides information about, and access to, a single method
on a class or interface. |
|
Member is an interface that reflects identifying information about
a single member (a field or a method) or a constructor.
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.
Constant Value:
1
public
static
final
int
PUBLIC
Identifies the set of all public members of a class or interface,
including inherited members.
Constant Value:
0
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
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.
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2024-07-10 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2024-07-10 UTC."],[[["\u003cp\u003eThe \u003ccode\u003eMember\u003c/code\u003e interface in Java reflection provides information about a single member (field, method, or constructor) of a class.\u003c/p\u003e\n"],["\u003cp\u003eIt includes methods to retrieve the declaring class, modifiers, name, and whether the member is synthetic.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003eMember\u003c/code\u003e has two constants, \u003ccode\u003eDECLARED\u003c/code\u003e and \u003ccode\u003ePUBLIC\u003c/code\u003e, used for filtering members.\u003c/p\u003e\n"],["\u003cp\u003eKnown indirect subclasses of \u003ccode\u003eMember\u003c/code\u003e include \u003ccode\u003eConstructor\u003c/code\u003e, \u003ccode\u003eExecutable\u003c/code\u003e, \u003ccode\u003eField\u003c/code\u003e, and \u003ccode\u003eMethod\u003c/code\u003e, offering more specific functionalities.\u003c/p\u003e\n"],["\u003cp\u003eYou can use \u003ccode\u003eMember\u003c/code\u003e to access and manipulate the structure of classes at runtime.\u003c/p\u003e\n"]]],["The `Member` interface provides methods to get information about class members, including fields, methods, and constructors. Key actions include retrieving the declaring class via `getDeclaringClass()`, obtaining modifiers with `getModifiers()`, getting the simple name using `getName()`, and checking if it's compiler-generated with `isSynthetic()`. Constants `DECLARED` and `PUBLIC` identify member visibility. Known subclasses are `Constructor`, `Executable`, `Field`, and `Method`.\n"],null,["# Member\n\npublic interface **Member** \n\n|---|---|---|\n| Known Indirect Subclasses [Constructor](../../../../reference/java/lang/reflect/Constructor.html)\\\u003cT\\\u003e, [Executable](../../../../reference/java/lang/reflect/Executable.html), [Field](../../../../reference/java/lang/reflect/Field.html), [Method](../../../../reference/java/lang/reflect/Method.html) |------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | [Constructor](../../../../reference/java/lang/reflect/Constructor.html)\\\u003cT\\\u003e | `Constructor` provides information about, and access to, a single constructor for a class. | | [Executable](../../../../reference/java/lang/reflect/Executable.html) | A shared superclass for the common functionality of [Method](../../../../reference/java/lang/reflect/Method.html) and [Constructor](../../../../reference/java/lang/reflect/Constructor.html). | | [Field](../../../../reference/java/lang/reflect/Field.html) | A `Field` provides information about, and dynamic access to, a single field of a class or an interface. | | [Method](../../../../reference/java/lang/reflect/Method.html) | A `Method` provides information about, and access to, a single method on a class or interface. | |||\n\nMember is an interface that reflects identifying information about\na single member (a field or a method) or a constructor. \n\n##### See Also\n\n- [Class](../../../../reference/java/lang/Class.html)\n- [Field](../../../../reference/java/lang/reflect/Field.html)\n- [Method](../../../../reference/java/lang/reflect/Method.html)\n- [Constructor](../../../../reference/java/lang/reflect/Constructor.html) \n\n### Constant Summary\n\n|-----|--------------------------------------------------------------------------|------------------------------------------------------------------------------------------------|\n| int | [DECLARED](../../../../reference/java/lang/reflect/Member.html#DECLARED) | Identifies the set of declared members of a class or interface. |\n| int | [PUBLIC](../../../../reference/java/lang/reflect/Member.html#PUBLIC) | Identifies the set of all public members of a class or interface, including inherited members. |\n\n### Public Method Summary\n\n|-------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| abstract [Class](../../../../reference/java/lang/Class.html)\\\u003c?\\\u003e | [getDeclaringClass](../../../../reference/java/lang/reflect/Member.html#getDeclaringClass())() Returns the Class object representing the class or interface that declares the member or constructor represented by this Member. |\n| abstract int | [getModifiers](../../../../reference/java/lang/reflect/Member.html#getModifiers())() Returns the Java language modifiers for the member or constructor represented by this Member, as an integer. |\n| abstract [String](../../../../reference/java/lang/String.html) | [getName](../../../../reference/java/lang/reflect/Member.html#getName())() Returns the simple name of the underlying member or constructor represented by this Member. |\n| abstract boolean | [isSynthetic](../../../../reference/java/lang/reflect/Member.html#isSynthetic())() Returns `true` if this member was introduced by the compiler; returns `false` otherwise. |\n\nConstants\n---------\n\n#### public static final int\n**DECLARED**\n\nIdentifies the set of declared members of a class or interface.\nInherited members are not included. \nConstant Value: 1 \n\n#### public static final int\n**PUBLIC**\n\nIdentifies the set of all public members of a class or interface,\nincluding inherited members. \nConstant Value: 0\n\nPublic Methods\n--------------\n\n#### public abstract [Class](../../../../reference/java/lang/Class.html)\\\u003c?\\\u003e\n**getDeclaringClass**\n()\n\nReturns the Class object representing the class or interface\nthat declares the member or constructor represented by this Member. \n\n##### Returns\n\n- an object representing the declaring class of the underlying member \n\n#### public abstract int\n**getModifiers**\n()\n\nReturns the Java language modifiers for the member or\nconstructor represented by this Member, as an integer. The\nModifier class should be used to decode the modifiers in\nthe integer. \n\n##### Returns\n\n- the Java language modifiers for the underlying member \n\n##### See Also\n\n- [Modifier](../../../../reference/java/lang/reflect/Modifier.html) \n\n#### public abstract [String](../../../../reference/java/lang/String.html)\n**getName**\n()\n\nReturns the simple name of the underlying member or constructor\nrepresented by this Member. \n\n##### Returns\n\n- the simple name of the underlying member \n\n#### public abstract boolean\n**isSynthetic**\n()\n\nReturns `true` if this member was introduced by\nthe compiler; returns `false` otherwise. \n\n##### Returns\n\n- true if and only if this member was introduced by the compiler."]]