PropertyNode (Groovy 5.0.7)
Description: declaration: package: org.codehaus.groovy.ast, class: PropertyNode

Package org.codehaus.groovy.ast

# Class PropertyNode

java.lang.Object
org.codehaus.groovy.ast.ASTNode
org.codehaus.groovy.ast.AnnotatedNode
org.codehaus.groovy.ast.PropertyNode

All Implemented Interfaces:
  `GroovydocHolder<AnnotatedNode>`, `NodeMetaDataHandler`, `Variable`

public class PropertyNode extends AnnotatedNode implements Variable
Represents a property (member variable, a getter and setter)

- ## Field Summary

  ### Fields inherited from interface groovy.lang.groovydoc.GroovydocHolder

  `DOC_COMMENT`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `PropertyNode(String name, int modifiers, ClassNode type, ClassNode owner, Expression initialValueExpression, Statement getterBlock, Statement setterBlock)`
  `PropertyNode(FieldNode field, int modifiers, Statement getterBlock, Statement setterBlock)`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `FieldNode`
  `getField()`
  `Statement`
  `getGetterBlock()`
  `String`
  `getGetterName()`
  `String`
  `getGetterNameOrDefault()`
  If an explicit getterName has been set, return that, otherwise return the default name for the property.
  `Expression`
  `getInitialExpression()`
  Returns the expression used to initialize the variable or null of there is no initialization.
  `int`
  `getModifiers()`
  `String`
  `getName()`
  Returns the name of the variable.
  `ClassNode`
  `getOriginType()`
  Returns the type before wrapping primitives type of the variable.
  `Statement`
  `getSetterBlock()`
  `String`
  `getSetterName()`
  `String`
  `getSetterNameOrDefault()`
  `ClassNode`
  `getType()`
  Returns the type of the variable.
  `boolean`
  `hasInitialExpression()`
  Returns true if there is an initialization expression.
  `boolean`
  `isDynamicTyped()`
  `boolean`
  `isInStaticContext()`
  Returns true if this variable is used in a static context.
  `void`
  `setField(FieldNode field)`
  `void`
  `setGetterBlock(Statement getterBlock)`
  `void`
  `setGetterName(String getterName)`
  `void`
  `setModifiers(int modifiers)`
  `void`
  `setSetterBlock(Statement setterBlock)`
  `void`
  `setSetterName(String setterName)`
  `void`
  `setType(ClassNode t)`

  ### Methods inherited from class org.codehaus.groovy.ast.AnnotatedNode

  `addAnnotation, addAnnotation, addAnnotations, getAnnotations, getAnnotations, getDeclaringClass, getGroovydoc, getInstance, hasNoRealSourcePosition, isSynthetic, setDeclaringClass, setHasNoRealSourcePosition, setSynthetic`

  ### Methods inherited from class org.codehaus.groovy.ast.ASTNode

  `copyNodeMetaData, getColumnNumber, getLastColumnNumber, getLastLineNumber, getLineNumber, getMetaDataMap, getText, setColumnNumber, setLastColumnNumber, setLastLineNumber, setLineNumber, setMetaDataMap, setSourcePosition, visit`

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

  ### Methods inherited from interface org.codehaus.groovy.ast.NodeMetaDataHandler

  `copyNodeMetaData, getNodeMetaData, getNodeMetaData, getNodeMetaData, newMetaDataMap, putNodeMetaData, removeNodeMetaData, setNodeMetaData`

  ### Methods inherited from interface org.codehaus.groovy.ast.Variable

  `isClosureSharedVariable, isFinal, isPrivate, isProtected, isPublic, isStatic, isVolatile, setClosureSharedVariable`

- ## Constructor Details

  - ### PropertyNode

    public PropertyNode(String name, int modifiers, ClassNode type, ClassNode owner, Expression initialValueExpression, Statement getterBlock, Statement setterBlock)

  - ### PropertyNode

    public PropertyNode(FieldNode field, int modifiers, Statement getterBlock, Statement setterBlock)

- ## Method Details

  - ### getField

    public FieldNode getField()

  - ### setField

    public void setField(FieldNode field)

  - ### getModifiers

    public int getModifiers()
    Specified by:
      `getModifiers` in interface `Variable`

  - ### setModifiers

    public void setModifiers(int modifiers)

  - ### getGetterBlock

    public Statement getGetterBlock()

  - ### setGetterBlock

    public void setGetterBlock(Statement getterBlock)

  - ### getSetterBlock

    public Statement getSetterBlock()

  - ### setSetterBlock

    public void setSetterBlock(Statement setterBlock)

  - ### getGetterName

    public String getGetterName()
    Since:
      4.0.0

  - ### getGetterNameOrDefault

    public String getGetterNameOrDefault()
    If an explicit getterName has been set, return that, otherwise return the default name for the property. For a property `foo`, the default name is `getFoo` except for a boolean property where `isFoo` is the default if no `getFoo` method exists in the declaring class.
    Since:
      4.0.0

  - ### setGetterName

    public void setGetterName(String getterName)
    Since:
      4.0.0

  - ### getSetterName

    public String getSetterName()
    Since:
      4.0.0

  - ### getSetterNameOrDefault

    public String getSetterNameOrDefault()
    Since:
      4.0.0

  - ### setSetterName

    public void setSetterName(String setterName)
    Since:
      4.0.0

  - ### getName

    public String getName()
    Description copied from interface: `Variable`
    Returns the name of the variable.
    Specified by:
      `getName` in interface `Variable`

  - ### getType

    public ClassNode getType()
    Description copied from interface: `Variable`
    Returns the type of the variable.
    Specified by:
      `getType` in interface `Variable`

  - ### getOriginType

    public ClassNode getOriginType()
    Description copied from interface: `Variable`
    Returns the type before wrapping primitives type of the variable.
    Specified by:
      `getOriginType` in interface `Variable`

  - ### setType

    public void setType(ClassNode t)

  - ### getInitialExpression

    public Expression getInitialExpression()
    Description copied from interface: `Variable`
    Returns the expression used to initialize the variable or null of there is no initialization.
    Specified by:
      `getInitialExpression` in interface `Variable`

  - ### hasInitialExpression

    public boolean hasInitialExpression()
    Description copied from interface: `Variable`
    Returns true if there is an initialization expression.
    Specified by:
      `hasInitialExpression` in interface `Variable`

  - ### isInStaticContext

    public boolean isInStaticContext()
    Description copied from interface: `Variable`
    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
    Specified by:
      `isInStaticContext` in interface `Variable`

  - ### isDynamicTyped

    public boolean isDynamicTyped()
    Specified by:
      `isDynamicTyped` in interface `Variable`