Package groovy.transform.options

# Class DefaultPropertyHandler

java.lang.Object
groovy.transform.options.PropertyHandler
groovy.transform.options.DefaultPropertyHandler

public class DefaultPropertyHandler extends PropertyHandler
Default implementation for validating and initializing transformed properties.

Since:
  2.5.0

- ## Field Summary

  ### Fields inherited from class groovy.transform.options.PropertyHandler

  `PROPERTY_OPTIONS_TYPE`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `DefaultPropertyHandler()`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `Statement`
  `createPropInit(AbstractASTTransformation xform, AnnotationNode anno, ClassNode cNode, PropertyNode pNode, Parameter namedArgsMap)`
  Create a statement that will initialize the property including any defensive copying.
  `boolean`
  `validateAttributes(AbstractASTTransformation xform, AnnotationNode anno)`
  Validates annotation attributes supported by this handler.
  `boolean`
  `validateProperties(AbstractASTTransformation xform, BlockStatement body, ClassNode cNode, List<PropertyNode> props)`
  Validates the properties selected for processing.

  ### Methods inherited from class groovy.transform.options.PropertyHandler

  `createPropertyHandler, createPropGetter, createPropSetter, isValidAttribute`

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

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

- ## Constructor Details

  - ### DefaultPropertyHandler

    public DefaultPropertyHandler()

- ## Method Details

  - ### validateAttributes

    public boolean validateAttributes(AbstractASTTransformation xform, AnnotationNode anno)
    Validates annotation attributes supported by this handler.
    Specified by:
      `validateAttributes` in class `PropertyHandler`
    Parameters:
      `xform` - the active transform
      `anno` - the property options annotation
    Returns:
      `true` if validation succeeds

  - ### validateProperties

    public boolean validateProperties(AbstractASTTransformation xform, BlockStatement body, ClassNode cNode, List<PropertyNode> props)
    Validates the properties selected for processing.
    Overrides:
      `validateProperties` in class `PropertyHandler`
    Parameters:
      `xform` - the active transform
      `body` - the statement block being generated
      `cNode` - the owning class
      `props` - the candidate properties
    Returns:
      `true` if validation succeeds

  - ### createPropInit

    public Statement createPropInit(AbstractASTTransformation xform, AnnotationNode anno, ClassNode cNode, PropertyNode pNode, Parameter namedArgsMap)
    Create a statement that will initialize the property including any defensive copying. Return `null` to indicate that no initialization statement should be emitted for this property; this is distinct from returning an empty block and skips the corresponding entry in the generated constructor body altogether.
    Specified by:
      `createPropInit` in class `PropertyHandler`
    Parameters:
      `xform` - the transform being processed
      `anno` - the annotation node
      `cNode` - the classnode containing the property
      `pNode` - the property node to initialize
      `namedArgsMap` - an "args" Map if the property value should come from a named arg map or null if not