com.sun.tools.apt.mirror.declaration
Class FieldDeclarationImpl
java.lang.Object
com.sun.tools.apt.mirror.declaration.DeclarationImpl
com.sun.tools.apt.mirror.declaration.MemberDeclarationImpl
com.sun.tools.apt.mirror.declaration.FieldDeclarationImpl
- All Implemented Interfaces:
- Declaration, FieldDeclaration, MemberDeclaration
- Direct Known Subclasses:
- EnumConstantDeclarationImpl
class FieldDeclarationImpl
- extends MemberDeclarationImpl
- implements FieldDeclaration
Implementation of FieldDeclaration
|
Method Summary |
void |
accept(DeclarationVisitor v)
Applies a visitor to this declaration. |
java.lang.String |
getConstantExpression()
Returns the text of a constant expression representing the
value of this field if this field is a compile-time constant. |
java.lang.Object |
getConstantValue()
Returns the value of this field if this field is a compile-time
constant. |
TypeMirror |
getType()
Returns the type of this field. |
java.lang.String |
toString()
Returns the field's name. |
| Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
sym
protected Symbol.VarSymbol sym
FieldDeclarationImpl
FieldDeclarationImpl(AptEnv env,
Symbol.VarSymbol sym)
toString
public java.lang.String toString()
- Returns the field's name.
- Overrides:
toString in class java.lang.Object
getType
public TypeMirror getType()
- Returns the type of this field.
- Specified by:
getType in interface FieldDeclaration
- Returns:
- the type of this field
getConstantValue
public java.lang.Object getConstantValue()
- Returns the value of this field if this field is a compile-time
constant. Returns null otherwise.
The value will be of a primitive type or String.
If the value is of a primitive type, it is wrapped in the
appropriate wrapper class (such as
Integer).
- Specified by:
getConstantValue in interface FieldDeclaration
- Returns:
- the value of this field if this field is a compile-time
constant, or null otherwise
getConstantExpression
public java.lang.String getConstantExpression()
- Returns the text of a constant expression representing the
value of this field if this field is a compile-time constant.
Returns null otherwise.
The value will be of a primitive type or String.
The text returned is in a form suitable for representing the value
in source code.
- Specified by:
getConstantExpression in interface FieldDeclaration
- Returns:
- the text of a constant expression if this field is a
compile-time constant, or null otherwise
accept
public void accept(DeclarationVisitor v)
- Applies a visitor to this declaration.
- Specified by:
accept in interface Declaration- Overrides:
accept in class MemberDeclarationImpl
- Parameters:
v - the visitor operating on this declaration