Package: groovy.transform.options

## [Java] Class DefaultPropertyHandler

- groovy.transform.options.DefaultPropertyHandler

-     public class DefaultPropertyHandler
      extends PropertyHandler

  Default implementation for validating and initializing transformed properties.

  Since:
    2.5.0

- - Inherited fields
    Fields inherited from class | Fields
    --- | ---
    `class PropertyHandler` | `PROPERTY_OPTIONS_TYPE`

  - ### Methods Summary

    Methods
    Type Params | Return Type | Name and description
    --- | --- | ---
    `` | `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. * * 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
    `` | `public boolean` | `validateAttributes(AbstractASTTransformation xform, AnnotationNode anno)` * Validates annotation attributes supported by this handler. * * Parameters: `xform` - the active transform * `anno` - the property options annotation * Returns: `true` if validation succeeds
    `` | `public boolean` | `validateProperties(AbstractASTTransformation xform, BlockStatement body, ClassNode cNode, List<PropertyNode> props)` * Validates the properties selected for processing. * * Parameters: `xform` - the active transform * `body` - the statement block being generated * `cNode` - the owning class * `props` - the candidate properties * Returns: `true` if validation succeeds

  - ### Inherited Methods Summary

    Inherited Methods
    Methods inherited from class | Name
    --- | ---
    `class PropertyHandler` | `createPropGetter, createPropInit, createPropSetter, createPropertyHandler, isValidAttribute, validateAttributes, validateProperties`

- - ### Method Detail

    - #### 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. * *

      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

    - #### public boolean validateAttributes(AbstractASTTransformation xform, AnnotationNode anno)

      * Validates annotation attributes supported by this handler. * *

      Parameters:
        `xform` - the active transform *
        `anno` - the property options annotation *
      Returns:
        `true` if validation succeeds

    - #### public boolean validateProperties(AbstractASTTransformation xform, BlockStatement body, ClassNode cNode, List<PropertyNode> props)

      * Validates the properties selected for processing. * *

      Parameters:
        `xform` - the active transform *
        `body` - the statement block being generated *
        `cNode` - the owning class *
        `props` - the candidate properties *
      Returns:
        `true` if validation succeeds