Java Reference
In-Depth Information
16.4. The Member classes
The classes
Field
,
Constructor
, and
Method
all implement the interface
Mem-
ber
, which has four methods for properties that all members share:
Class
geTDeclaringClass()
Returns the
Class
object for the class in which this member is
declared.
String
getName()
Returns the name of this member.
int
getModifiers()
Returns the language modifiers for the member encoded as an
integer. This value should be decoded using the
Modifier
class.
boolean
isSynthetic()
Returns
true
if this member is a synthetic member that was
created by the compiler. For example, synthetic fields are often
created in an inner class to hold a reference to the enclos-
ing instance, and synthetic "bridge" methods are generated to
support generic typessee
Section A.3.1
on page
745
.
Although a class or interface can be a member of another class, for his-
torical reasons the class
Class
does not implement
Member
, although it
supports methods of the same name and contract.
The
toString
method of all
Member
classes includes the complete declara-
tion for the member, similar to how it would appear in your source code,
including modifiers, type, and parameter types (where applicable). For
historical reasons,
toString
does not include generic type information.
The
toGenericString
method provides a more complete representation of