Package org.codehaus.groovy.ast.tools

# Class BeanUtils

java.lang.Object
org.codehaus.groovy.ast.tools.BeanUtils

public class BeanUtils extends Object
Utility methods for discovering and working with bean properties on `ClassNode` instances.

This utility supports JavaBean property conventions including:

- Explicit properties defined via the `@Property` annotation
- Pseudo-properties from getter methods following JavaBean naming conventions (getXxx, isXxx)
- Pseudo-properties from setter methods following JavaBean naming conventions (setXxx)
- Inherited properties from superclasses and interfaces
- Static property filtering

Commonly used in AST transformation and type checking to analyze class structure and generate property access patterns.

See Also:
  - `for property representation`
  - `for class information`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `static void`
  `addPseudoProperties(ClassNode origType, ClassNode cNode, List<PropertyNode> result, Set<String> names, boolean includeStatic, boolean includePseudoGetters, boolean includePseudoSetters)`
  Adds pseudo-properties for getters and setters to a property list.
  `static void`
  `addPseudoProperties(ClassNode origType, ClassNode cNode, List<PropertyNode> result, Set<String> names, boolean includeStatic, boolean includePseudoGetters, boolean includePseudoSetters, boolean traverseSuperClasses)`
  Adds pseudo-properties for getters and setters to a property list, optionally traversing superclasses.
  `static List<PropertyNode>`
  `getAllProperties(ClassNode type, boolean includeSuperProperties, boolean includeStatic, boolean includePseudoGetters)`
  Discovers all properties in a class, optionally including inherited and pseudo-properties.
  `static List<PropertyNode>`
  `getAllProperties(ClassNode type, boolean includeSuperProperties, boolean includeStatic, boolean includePseudoGetters, boolean includePseudoSetters, boolean superFirst)`
  Discovers all properties in a class, optionally including both getter and setter pseudo-properties.

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

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

- ## Method Details

  - ### getAllProperties

    public static List<PropertyNode> getAllProperties(ClassNode type, boolean includeSuperProperties, boolean includeStatic, boolean includePseudoGetters)
    Discovers all properties in a class, optionally including inherited and pseudo-properties. Pseudo-properties are derived from getter methods following JavaBean naming conventions.
    Parameters:
      `type` - the `ClassNode` to analyze
      `includeSuperProperties` - whether to include properties from superclasses
      `includeStatic` - whether to include static properties
      `includePseudoGetters` - whether to include pseudo-properties created from getXxx/isXxx methods
    Returns:
      a list of all discovered `PropertyNode`s, may be empty
    See Also:
      - `getAllProperties(ClassNode, boolean, boolean, boolean, boolean, boolean)`

  - ### getAllProperties

    public static List<PropertyNode> getAllProperties(ClassNode type, boolean includeSuperProperties, boolean includeStatic, boolean includePseudoGetters, boolean includePseudoSetters, boolean superFirst)
    Discovers all properties in a class, optionally including both getter and setter pseudo-properties. Pseudo-properties include JavaBean getters (getXxx/isXxx) and setters (setXxx) without corresponding fields.
    Parameters:
      `type` - the `ClassNode` to analyze
      `includeSuperProperties` - whether to include properties from superclasses
      `includeStatic` - whether to include static properties
      `includePseudoGetters` - whether to include pseudo-properties from getter methods
      `includePseudoSetters` - whether to include pseudo-properties from setter methods
      `superFirst` - whether to list superclass properties before current class properties
    Returns:
      a list of all discovered `PropertyNode`s, with order controlled by superFirst, may be empty

  - ### addPseudoProperties

    public static void addPseudoProperties(ClassNode origType, ClassNode cNode, List<PropertyNode> result, Set<String> names, boolean includeStatic, boolean includePseudoGetters, boolean includePseudoSetters)
    Adds pseudo-properties for getters and setters to a property list. Pseudo-properties are created from methods following JavaBean naming conventions but without corresponding field declarations.
    Parameters:
      `origType` - the original type being analyzed (used for access checks)
      `cNode` - the class node to scan for getter/setter methods
      `result` - the list to accumulate discovered pseudo-properties
      `names` - a set tracking property names already discovered (to prevent duplicates)
      `includeStatic` - whether to include static methods
      `includePseudoGetters` - whether to add properties from getter methods
      `includePseudoSetters` - whether to add properties from setter methods

  - ### addPseudoProperties

    public static void addPseudoProperties(ClassNode origType, ClassNode cNode, List<PropertyNode> result, Set<String> names, boolean includeStatic, boolean includePseudoGetters, boolean includePseudoSetters, boolean traverseSuperClasses)
    Adds pseudo-properties for getters and setters to a property list, optionally traversing superclasses. Pseudo-properties are created from methods following JavaBean naming conventions but without corresponding field declarations. Methods marked with `@Internal` are skipped.
    Parameters:
      `origType` - the original type being analyzed (used for access checks)
      `cNode` - the class node to scan for getter/setter methods
      `result` - the list to accumulate discovered pseudo-properties
      `names` - a set tracking property names already discovered (to prevent duplicates)
      `includeStatic` - whether to include static methods
      `includePseudoGetters` - whether to add properties from getXxx/isXxx getter methods
      `includePseudoSetters` - whether to add properties from setXxx setter methods
      `traverseSuperClasses` - whether to include inherited methods from superclasses