|
Evaluating Software Design Patterns — the "Gang of Four" patterns implemented in Java 6 |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object dk.rode.thesis.meta.reflect.Caller.MemberContext
public static final class Caller.MemberContext
A member context represents a member in a given
calling context, which may or may not be uniquely
resolved
.
The member represents a static initialiser block, an instance
initialiser block, a constructor, or a method. The type is
determined via the type
attribute.
If the member is uniquely resolved, the resolved member is
stored in the member
attribute, and the resolved
attribute is true. If not uniquely resolved, resolved
is false, and member
contains the first matching
candidate
.
It will not be possible to uniquely resolve a member in case
the calling context represents an overloaded method; a constructor
and/or instance initialisation block declared in a class that declares
multiple constructors and/or initialisation blocks; or a static
initialisation block declared in a class that declares several
static initialisation blocks. Furthermore, there is no Member
instance corresponding to an initialisation block, static or otherwise.
For instance initialisation blocks, the Constructor
class
is used. For static initialisation blocks, member
is null
and the candidate array is empty, and type
is set to
Caller.CallerType.INITIALISATION
.
The line number of the member in question is unique and
is stored in the lineNumber
attribute.
Field Summary | |
---|---|
protected Member[] |
candidates
The possible member candidates for the member represented by this member context. |
private StackTraceElement |
element
The stack trace element element identifying the member for this member context. |
int |
lineNumber
The line number of the stack trace element identifying the member used by this member context. |
Member |
member
The member represented by this member context. |
boolean |
resolved
True if member has been uniquely resolved
for this member context, false if not. |
Caller.CallerType |
type
The identified member type of this member context. |
Constructor Summary | |
---|---|
Caller.MemberContext(StackTraceElement element)
Constructor, which creates this member context to represent the member identified by the stack trace element supplied as element . |
Method Summary | |
---|---|
boolean |
equals(Object object)
Returns true if object is an instance
of this class identifying a member based on an
equal stack trace element, false if not. |
Member[] |
getCandidates()
Returns the possible candidates that match the member this member context tries to identify. |
int |
hashCode()
Returns the hash code of this member context. |
String |
toString()
Returns the string representation of this member context. |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected final Member[] candidates
If resolved
is true, the single element contained
is member
.
If this member context represents a static initialisation block, the array is empty.
The order of the candidates is their declaration order.
private final StackTraceElement element
Never null.
public final int lineNumber
public final Member member
If resolved
is true, the member is uniquely
resolved, not if false.
If resolved
is false, the possible
candidates can be retrieved with getCandidates()
,
and the first member from the candidate array
is stored in this attribute.
Will be null in case this member context represents
a static initialisation block, but a Constructor
instance in case this member context represents
an instance initialisation block.
public final boolean resolved
member
has been uniquely resolved
for this member context, false if not.
public final Caller.CallerType type
Never null.
Constructor Detail |
---|
Caller.MemberContext(StackTraceElement element)
element
.
element
- The stack trace element identifying the
member; cannot be null.
NullPointerException
- If element
is null.Method Detail |
---|
public boolean equals(Object object)
object
is an instance
of this class identifying a member based on an
equal stack trace element, false if not.
equals
in class Object
public Member[] getCandidates()
If resolved
is true, the returned array will
only contain member
.
If this member context represents a static initialisation block, the returned array will be empty. If it represents an instance initialisation block, the returned array contains all declared constructors.
The order of the candidates is their declaration order.
Modifying the returned array will not affect this member context.
public int hashCode()
hashCode
in class Object
public String toString()
The representation corresponds to that of the stack trace element used to identify the actual member.
toString
in class Object
|
Gunni Rode / rode.dk | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |