Top Description Fields Constructors Methods
org.codehaus.groovy.ast

public Class FieldNode

extends AnnotatedNode
implements Opcodes, Variable
Class Inheritance
All Implemented Interfaces
org.codehaus.groovy.ast.Variable, org.objectweb.asm.Opcodes
Known Direct Subclasses
org.codehaus.groovy.ast.decompiled.LazyFieldNode
Imports
org.codehaus.groovy.ast.expr.Expression, org.objectweb.asm.Opcodes, java.lang.reflect.Field

Represents a field (member variable)

Field Summary

Modifier and TypeField and Description
private boolean
private boolean
private Expression
private int
private String
private ClassNode
private ClassNode
private ClassNode

Constructor Summary

AccessConstructor and Description
protected
public
FieldNode(String name, int modifiers, ClassNode type, ClassNode owner, Expression initialValueExpression)

Method Summary

Modifier and TypeMethod and Description
public boolean
equals(Object
the reference object with which to compare.
obj
)

Overrides java.lang.Object.equals.

Indicates whether some other object is "equal to" this one.
public Expression
getInitialExpression()

Implements org.codehaus.groovy.ast.Variable.getInitialExpression.

expression used to initialize the variable or null of there is no initialization.
public Expression
public int
public String
getName()

Implements org.codehaus.groovy.ast.Variable.getName.

the name of the variable
public ClassNode
getOriginType()

Implements org.codehaus.groovy.ast.Variable.getOriginType.

the type before wrapping primitives type of the variable
public ClassNode
public ClassNode
getType()

Implements org.codehaus.groovy.ast.Variable.getType.

the type of the variable
public boolean
hasInitialExpression()

Implements org.codehaus.groovy.ast.Variable.hasInitialExpression.

returns true if there is an initialization expression
public boolean
public boolean
public boolean

Returns:

true if the field is an enum
isEnum
()

public boolean

Returns:

true if the field is final
isFinal
()

public boolean
public boolean
isInStaticContext()

Implements org.codehaus.groovy.ast.Variable.isInStaticContext.

returns true if this variable is used in a static context.
public boolean

Returns:

true if the field is private
isPrivate
()

public boolean

Returns:

true if the field is protected
isProtected
()

public boolean

Returns:

true if the field is public
isPublic
()

public boolean

Returns:

true if the field is static
isStatic
()

public boolean

Returns:

true if the field is volatile
isVolatile
()

public static FieldNode
newStatic(Class<T> theClass, String name)

public void
rename(String name)

public void
public void
setHolder(boolean holder)

public void
setInitialValueExpression(Expression initialValueExpression)

public void
setModifiers(int modifiers)

public void
public void
setOwner(ClassNode
The owner to set.
owner
)

public void
Inherited from org.codehaus.groovy.ast.AnnotatedNode:
addAnnotationaddAnnotationsgetAnnotationsgetAnnotationsgetDeclaringClassgetGroovydocgetInstancehasNoRealSourcePositionisSyntheticsetDeclaringClasssetHasNoRealSourcePositionsetSynthetic

Field Detail

dynamicTypedback to summary
private boolean dynamicTyped
holderback to summary
private boolean holder
initialValueExpressionback to summary
private Expression initialValueExpression
modifiersback to summary
private int modifiers
nameback to summary
private String name
originTypeback to summary
private ClassNode originType
ownerback to summary
private ClassNode owner
typeback to summary
private ClassNode type

Constructor Detail

FieldNodeback to summary
protected FieldNode()
FieldNodeback to summary
public FieldNode(String name, int modifiers, ClassNode type, ClassNode owner, Expression initialValueExpression)

Method Detail

equalsback to summary
public boolean equals(Object obj)

Overrides java.lang.Object.equals.

Doc from java.lang.Object.equals.

Indicates whether some other object is "equal to" this one.

The equals method implements an equivalence relation on non-null object references:

  • It is reflexive: for any non-null reference value x, x.equals(x) should return true.
  • It is symmetric: for any non-null reference values x and y, x.equals(y) should return true if and only if y.equals(x) returns true.
  • It is transitive: for any non-null reference values x, y, and z, if x.equals(y) returns true and y.equals(z) returns true, then x.equals(z) should return true.
  • It is consistent: for any non-null reference values x and y, multiple invocations of x.equals(y) consistently return true or consistently return false, provided no information used in equals comparisons on the objects is modified.
  • For any non-null reference value x, x.equals(null) should return false.

An equivalence relation partitions the elements it operates on into equivalence classes; all the members of an equivalence class are equal to each other. Members of an equivalence class are substitutable for each other, at least for some purposes.

Parameters
obj:Object

the reference object with which to compare.

Returns:boolean

true if this object is the same as the obj argument; false otherwise.

Annotations
@Override
getInitialExpressionback to summary
public Expression getInitialExpression()

Implements org.codehaus.groovy.ast.Variable.getInitialExpression.

Doc from org.codehaus.groovy.ast.Variable.getInitialExpression.

expression used to initialize the variable or null of there is no initialization.

Annotations
@Override
getInitialValueExpressionback to summary
public Expression getInitialValueExpression()
getModifiersback to summary
public int getModifiers()

Implements org.codehaus.groovy.ast.Variable.getModifiers.

Annotations
@Override
getNameback to summary
public String getName()

Implements org.codehaus.groovy.ast.Variable.getName.

Doc from org.codehaus.groovy.ast.Variable.getName.

the name of the variable

Annotations
@Override
getOriginTypeback to summary
public ClassNode getOriginType()

Implements org.codehaus.groovy.ast.Variable.getOriginType.

Doc from org.codehaus.groovy.ast.Variable.getOriginType.

the type before wrapping primitives type of the variable

Annotations
@Override
getOwnerback to summary
public ClassNode getOwner()
getTypeback to summary
public ClassNode getType()

Implements org.codehaus.groovy.ast.Variable.getType.

Doc from org.codehaus.groovy.ast.Variable.getType.

the type of the variable

Annotations
@Override
hasInitialExpressionback to summary
public boolean hasInitialExpression()

Implements org.codehaus.groovy.ast.Variable.hasInitialExpression.

Doc from org.codehaus.groovy.ast.Variable.hasInitialExpression.

returns true if there is an initialization expression

Annotations
@Override
isClosureSharedVariableback to summary
public boolean isClosureSharedVariable()

Implements org.codehaus.groovy.ast.Variable.isClosureSharedVariable.

Deprecated

Annotations
@Deprecated
@Override
isDynamicTypedback to summary
public boolean isDynamicTyped()

Implements org.codehaus.groovy.ast.Variable.isDynamicTyped.

Annotations
@Override
isEnumback to summary
public boolean isEnum()
Returns:boolean

true if the field is an enum

isFinalback to summary
public boolean isFinal()
Returns:boolean

true if the field is final

isHolderback to summary
public boolean isHolder()
isInStaticContextback to summary
public boolean isInStaticContext()

Implements org.codehaus.groovy.ast.Variable.isInStaticContext.

Doc from org.codehaus.groovy.ast.Variable.isInStaticContext.

returns true if this variable is used in a static context. A static context is any static initializer block, when this variable is declared as static or when this variable is used in a static method

Annotations
@Override
isPrivateback to summary
public boolean isPrivate()
Returns:boolean

true if the field is private

Since
2.5.0
isProtectedback to summary
public boolean isProtected()
Returns:boolean

true if the field is protected

isPublicback to summary
public boolean isPublic()
Returns:boolean

true if the field is public

isStaticback to summary
public boolean isStatic()
Returns:boolean

true if the field is static

isVolatileback to summary
public boolean isVolatile()
Returns:boolean

true if the field is volatile

newStaticback to summary
public static FieldNode newStatic(Class<T> theClass, String name) throws SecurityException, NoSuchFieldException
renameback to summary
public void rename(String name)
setClosureSharedVariableback to summary
public void setClosureSharedVariable(boolean inClosure)

Implements org.codehaus.groovy.ast.Variable.setClosureSharedVariable.

Deprecated

Annotations
@Deprecated
@Override
setHolderback to summary
public void setHolder(boolean holder)
setInitialValueExpressionback to summary
public void setInitialValueExpression(Expression initialValueExpression)
setModifiersback to summary
public void setModifiers(int modifiers)
setOriginTypeback to summary
public void setOriginType(ClassNode cn)
setOwnerback to summary
public void setOwner(ClassNode owner)
Parameters
owner:ClassNode

The owner to set.

setTypeback to summary
public void setType(ClassNode type)