com.sun.tools.apt.mirror.declaration
Class FieldDeclarationImpl

java.lang.Object
  extended by com.sun.tools.apt.mirror.declaration.DeclarationImpl
      extended by com.sun.tools.apt.mirror.declaration.MemberDeclarationImpl
          extended by 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


Field Summary
protected  Symbol.VarSymbol sym
           
 
Fields inherited from class com.sun.tools.apt.mirror.declaration.DeclarationImpl
env, identityFilter
 
Constructor Summary
FieldDeclarationImpl(AptEnv env, Symbol.VarSymbol sym)
           
 
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 com.sun.tools.apt.mirror.declaration.MemberDeclarationImpl
getDeclaringType, getFormalTypeParameters, typeParamsToString
 
Methods inherited from class com.sun.tools.apt.mirror.declaration.DeclarationImpl
equals, getAnnotation, getAnnotation, getAnnotationMirrors, getDocComment, getMembers, getModifiers, getPosition, getSimpleName, hashCode
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.sun.mirror.declaration.MemberDeclaration
getDeclaringType
 
Methods inherited from interface com.sun.mirror.declaration.Declaration
equals, getAnnotation, getAnnotationMirrors, getDocComment, getModifiers, getPosition, getSimpleName
 

Field Detail

sym

protected Symbol.VarSymbol sym
Constructor Detail

FieldDeclarationImpl

FieldDeclarationImpl(AptEnv env,
                     Symbol.VarSymbol sym)
Method Detail

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