Package org.eclipse.jdt.core
Interface IMemberValuePair
-
public interface IMemberValuePair
Represents a member-value pair of an annotation. Thevalue
is represented by anObject
. To get the exact type of this object, use itsvalue kind
. If this value is an array,getValue()
returns an instance ofObject
[] and the value kind returns the kind of the elements in this array.This interface is not intended to be implemented or extended by clients.
- Since:
- 3.4
-
-
Field Summary
Fields Modifier and Type Field Description static int
K_ANNOTATION
Constant indicating that the value kind is an annotation represented by an instance ofIAnnotation
.static int
K_BOOLEAN
Constant indicating that the value kind is aboolean
represented by an instance ofBoolean
.static int
K_BYTE
Constant indicating that the value kind is abyte
represented by an instance ofByte
.static int
K_CHAR
Constant indicating that the value kind is achar
represented by an instance ofCharacter
.static int
K_CLASS
static int
K_DOUBLE
Constant indicating that the value kind is adouble
represented by an instance ofDouble
.static int
K_FLOAT
Constant indicating that the value kind is afloat
represented by an instance ofFloat
.static int
K_INT
Constant indicating that the value kind is anint
represented by an instance ofInteger
.static int
K_LONG
Constant indicating that the value kind is along
represented by an instance ofLong
.static int
K_QUALIFIED_NAME
Constant indicating that the value is a qualified name represented by aString
.static int
K_SHORT
Constant indicating that the value kind is ashort
represented by an instance ofShort
.static int
K_SIMPLE_NAME
Constant indicating that the value is a simple name represented by aString
.static int
K_STRING
static int
K_UNKNOWN
Constant indicating that the value kind is unknown at this stage.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description String
getMemberName()
Returns the member's name of this member-value pair.Object
getValue()
Returns the value of this member-value pair.int
getValueKind()
Returns the value kind of this member-value pair.
-
-
-
Field Detail
-
K_INT
static final int K_INT
Constant indicating that the value kind is anint
represented by an instance ofInteger
.- See Also:
- Constant Field Values
-
K_BYTE
static final int K_BYTE
Constant indicating that the value kind is abyte
represented by an instance ofByte
.- See Also:
- Constant Field Values
-
K_SHORT
static final int K_SHORT
Constant indicating that the value kind is ashort
represented by an instance ofShort
.- See Also:
- Constant Field Values
-
K_CHAR
static final int K_CHAR
Constant indicating that the value kind is achar
represented by an instance ofCharacter
.- See Also:
- Constant Field Values
-
K_FLOAT
static final int K_FLOAT
Constant indicating that the value kind is afloat
represented by an instance ofFloat
.- See Also:
- Constant Field Values
-
K_DOUBLE
static final int K_DOUBLE
Constant indicating that the value kind is adouble
represented by an instance ofDouble
.- See Also:
- Constant Field Values
-
K_LONG
static final int K_LONG
Constant indicating that the value kind is along
represented by an instance ofLong
.- See Also:
- Constant Field Values
-
K_BOOLEAN
static final int K_BOOLEAN
Constant indicating that the value kind is aboolean
represented by an instance ofBoolean
.- See Also:
- Constant Field Values
-
K_STRING
static final int K_STRING
- See Also:
- Constant Field Values
-
K_ANNOTATION
static final int K_ANNOTATION
Constant indicating that the value kind is an annotation represented by an instance ofIAnnotation
.- See Also:
- Constant Field Values
-
K_CLASS
static final int K_CLASS
Constant indicating that the value kind is aClass
represented by the name of the class (i.e. aString
. If the member-value pair is coming from a compilation unit, this is either a simple name (e.g. forMyType.class
, the name is "MyType"), or a qualified name (e.g. forx.y.MyType.MyNestedType.class
, the name is "x.y.MyType.MyNestedType"). If the member-value pair is coming from a class file, this is always a fully qualified name.Note that one can use
IType.resolveType(String)
and e.g.IJavaProject.findType(String, String, org.eclipse.core.runtime.IProgressMonitor)
to find the correspondingIType
.- See Also:
- Constant Field Values
-
K_QUALIFIED_NAME
static final int K_QUALIFIED_NAME
Constant indicating that the value is a qualified name represented by aString
. The qualified name refers to an enum constant or another compile-time constant if the code is correct (e.g. "MyEnum.FIRST").- See Also:
- Constant Field Values
-
K_SIMPLE_NAME
static final int K_SIMPLE_NAME
Constant indicating that the value is a simple name represented by aString
. The simple name refers to an enum constant or another compile-time constant if the code is correct (e.g. "FIRST" when there is a static import for "MyEnum.FIRST").- See Also:
- Constant Field Values
-
K_UNKNOWN
static final int K_UNKNOWN
Constant indicating that the value kind is unknown at this stage. The value is unknown in the following cases:- the value is an expression that would need to be further analyzed to determine its kind. For
example, in
@MyAnnot(1 + 2.3)
the kind of the expression "1 + 2.3" is unknown - the value is an array of size 0, e.g.
@MyAnnot({})
- the value is an array that contains at least one expression that would need to be further
analyzed to determine its kind. For example, in
@MyAnnot({3.4, 1 + 2.3})
, the kind of the second element "1 + 2.3" is unknown. - the value is an array that contains heterogeneous values, e.g.
@MyAnnot({1, 2.3, "abc"})
null
, or an array containingObject
s and/ornull
s for unknown elements.- See Also:
- Constant Field Values
- the value is an expression that would need to be further analyzed to determine its kind. For
example, in
-
-
Method Detail
-
getMemberName
String getMemberName()
Returns the member's name of this member-value pair.- Returns:
- the member's name of this member-value pair.
-
getValue
Object getValue()
Returns the value of this member-value pair. The type of this value is function of this member-value pair'svalue kind
. It is an instance ofObject
[] if the value is an array.If the value kind is
K_UNKNOWN
and the value is not an array, then the value isnull
. If the value kind isK_UNKNOWN
and the value is an array, then the value is an array containingObject
s and/ornull
s for unknown elements. SeeK_UNKNOWN
for more details.- Returns:
- the value of this member-value pair.
-
getValueKind
int getValueKind()
Returns the value kind of this member-value pair. This indicates the instance of the returnedvalue
, or the instance of the elements if the value is an array. The value kind is one of the following constants:K_ANNOTATION
,K_BOOLEAN
,K_BYTE
,K_CHAR
,K_CLASS
,K_DOUBLE
,K_FLOAT
,K_INT
,K_LONG
,K_QUALIFIED_NAME
,K_SIMPLE_NAME
,K_SHORT
,K_STRING
,K_UNKNOWN
.- Returns:
- the value kind of this member-value pair
-
-