Package: org.codehaus.groovy.transform

## [Java] Class EqualsAndHashCodeASTTransformation

- org.codehaus.groovy.transform.EqualsAndHashCodeASTTransformation

-     @GroovyASTTransformation(phase = CompilePhase.CANONICALIZATION)
      public class EqualsAndHashCodeASTTransformation
      extends AbstractASTTransformation

  Handles generation of equals() and hashCode() methods via the EqualsAndHashCode annotation.

- - Inherited fields
    Fields inherited from class | Fields
    --- | ---
    `class AbstractASTTransformation` | `RETENTION_CLASSNODE, sourceUnit`

  - ### Methods Summary

    Methods
    Type Params | Return Type | Name and description
    --- | --- | ---
    `` | `public static void` | `createEquals(ClassNode cNode, boolean includeFields, boolean callSuper, boolean useCanEqual, List<String> excludes, List<String> includes)` Generates an equals method for the given class.
    `` | `public static void` | `createEquals(ClassNode cNode, boolean includeFields, boolean callSuper, boolean useCanEqual, List<String> excludes, List<String> includes, boolean allNames)` Generates an equals method for the given class.
    `` | `public static void` | `createEquals(ClassNode cNode, boolean includeFields, boolean callSuper, boolean useCanEqual, List<String> excludes, List<String> includes, boolean allNames, boolean allProperties)` Generates an equals method for the given class.
    `` | `public static void` | `createEquals(ClassNode cNode, boolean includeFields, boolean callSuper, boolean useCanEqual, List<String> excludes, List<String> includes, boolean allNames, boolean allProperties, boolean pojo)` Generates an equals method for the given class.
    `` | `public static void` | `createEquals(ClassNode cNode, boolean includeFields, boolean callSuper, boolean useCanEqual, List<String> excludes, List<String> includes, boolean allNames, boolean allProperties, boolean pojo, boolean useGetter)` Generates an equals method for the given class.
    `` | `public static void` | `createHashCode(ClassNode cNode, boolean cacheResult, boolean includeFields, boolean callSuper, List<String> excludes, List<String> includes)` Generates a hashCode method for the given class.
    `` | `public static void` | `createHashCode(ClassNode cNode, boolean cacheResult, boolean includeFields, boolean callSuper, List<String> excludes, List<String> includes, boolean allNames)` Generates a hashCode method for the given class.
    `` | `public static void` | `createHashCode(ClassNode cNode, boolean cacheResult, boolean includeFields, boolean callSuper, List<String> excludes, List<String> includes, boolean allNames, boolean allProperties)` Generates a hashCode method for the given class.
    `` | `public static void` | `createHashCode(ClassNode cNode, boolean cacheResult, boolean includeFields, boolean callSuper, List<String> excludes, List<String> includes, boolean allNames, boolean allProperties, boolean pojo)` Generates a hashCode method for the given class.
    `` | `public static void` | `createHashCode(ClassNode cNode, boolean cacheResult, boolean includeFields, boolean callSuper, List<String> excludes, List<String> includes, boolean allNames, boolean allProperties, boolean pojo, boolean useGetter)` Generates a hashCode method for the given class.
    `` | `public void` | `visit(ASTNode[] nodes, SourceUnit source)`

  - ### Inherited Methods Summary

    Inherited Methods
    Methods inherited from class | Name
    --- | ---
    `class AbstractASTTransformation` | `addError, checkIncludeExcludeUndefinedAware, checkIncludeExcludeUndefinedAware, checkNotInterface, checkPropertyList, checkPropertyList, checkPropertyList, copyAnnotatedNodeAnnotations, copyAnnotatedNodeAnnotations, deemedInternal, deemedInternalName, getAnnotationName, getMemberClassList, getMemberClassValue, getMemberClassValue, getMemberIntValue, getMemberStringList, getMemberStringValue, getMemberStringValue, getMemberValue, hasAnnotation, init, markAsInternal, memberHasValue, shouldSkip, shouldSkip, shouldSkip, shouldSkipOnDescriptorUndefinedAware, shouldSkipUndefinedAware, shouldSkipUndefinedAware, shouldSkipUndefinedAware, tokenize`

- - ### Method Detail

    - #### public static void createEquals(ClassNode cNode, boolean includeFields, boolean callSuper, boolean useCanEqual, List<String> excludes, List<String> includes)

      Generates an equals method for the given class.

      Parameters:
        `cNode` - the class to add equals method to
        `includeFields` - whether to include fields in the comparison
        `callSuper` - whether to include superclass comparison
        `useCanEqual` - whether to generate and use a canEqual helper method
        `excludes` - property names to exclude
        `includes` - property names to include

    - #### public static void createEquals(ClassNode cNode, boolean includeFields, boolean callSuper, boolean useCanEqual, List<String> excludes, List<String> includes, boolean allNames)

      Generates an equals method for the given class.

      Parameters:
        `cNode` - the class to add equals method to
        `includeFields` - whether to include fields in the comparison
        `callSuper` - whether to include superclass comparison
        `useCanEqual` - whether to generate and use a canEqual helper method
        `excludes` - property names to exclude
        `includes` - property names to include
        `allNames` - whether to include all names (including internal ones with '$')

    - #### public static void createEquals(ClassNode cNode, boolean includeFields, boolean callSuper, boolean useCanEqual, List<String> excludes, List<String> includes, boolean allNames, boolean allProperties)

      Generates an equals method for the given class.

      Parameters:
        `cNode` - the class to add equals method to
        `includeFields` - whether to include fields in the comparison
        `callSuper` - whether to include superclass comparison
        `useCanEqual` - whether to generate and use a canEqual helper method
        `excludes` - property names to exclude
        `includes` - property names to include
        `allNames` - whether to include all names (including internal ones with '$')
        `allProperties` - whether to process all properties

    - #### public static void createEquals(ClassNode cNode, boolean includeFields, boolean callSuper, boolean useCanEqual, List<String> excludes, List<String> includes, boolean allNames, boolean allProperties, boolean pojo)

      Generates an equals method for the given class.

      Parameters:
        `cNode` - the class to add equals method to
        `includeFields` - whether to include fields in the comparison
        `callSuper` - whether to include superclass comparison
        `useCanEqual` - whether to generate and use a canEqual helper method
        `excludes` - property names to exclude
        `includes` - property names to include
        `allNames` - whether to include all names (including internal ones with '$')
        `allProperties` - whether to process all properties
        `pojo` - whether to treat as plain old Java object

    - #### public static void createEquals(ClassNode cNode, boolean includeFields, boolean callSuper, boolean useCanEqual, List<String> excludes, List<String> includes, boolean allNames, boolean allProperties, boolean pojo, boolean useGetter)

      Generates an equals method for the given class.

      Parameters:
        `cNode` - the class to add equals method to
        `includeFields` - whether to include fields in the comparison
        `callSuper` - whether to include superclass comparison
        `useCanEqual` - whether to generate and use a canEqual helper method
        `excludes` - property names to exclude
        `includes` - property names to include
        `allNames` - whether to include all names (including internal ones with '$')
        `allProperties` - whether to process all properties
        `pojo` - whether to treat as plain old Java object
        `useGetter` - whether to use getter methods instead of direct field access

    - #### public static void createHashCode(ClassNode cNode, boolean cacheResult, boolean includeFields, boolean callSuper, List<String> excludes, List<String> includes)

      Generates a hashCode method for the given class.

      Parameters:
        `cNode` - the class to add hashCode method to
        `cacheResult` - whether to cache the hash code in a field
        `includeFields` - whether to include fields in the hash code
        `callSuper` - whether to include superclass hash code
        `excludes` - property names to exclude
        `includes` - property names to include

    - #### public static void createHashCode(ClassNode cNode, boolean cacheResult, boolean includeFields, boolean callSuper, List<String> excludes, List<String> includes, boolean allNames)

      Generates a hashCode method for the given class.

      Parameters:
        `cNode` - the class to add hashCode method to
        `cacheResult` - whether to cache the hash code in a field
        `includeFields` - whether to include fields in the hash code
        `callSuper` - whether to include superclass hash code
        `excludes` - property names to exclude
        `includes` - property names to include
        `allNames` - whether to include all names (including internal ones with '$')

    - #### public static void createHashCode(ClassNode cNode, boolean cacheResult, boolean includeFields, boolean callSuper, List<String> excludes, List<String> includes, boolean allNames, boolean allProperties)

      Generates a hashCode method for the given class.

      Parameters:
        `cNode` - the class to add hashCode method to
        `cacheResult` - whether to cache the hash code in a field
        `includeFields` - whether to include fields in the hash code
        `callSuper` - whether to include superclass hash code
        `excludes` - property names to exclude
        `includes` - property names to include
        `allNames` - whether to include all names (including internal ones with '$')
        `allProperties` - whether to process all properties

    - #### public static void createHashCode(ClassNode cNode, boolean cacheResult, boolean includeFields, boolean callSuper, List<String> excludes, List<String> includes, boolean allNames, boolean allProperties, boolean pojo)

      Generates a hashCode method for the given class.

      Parameters:
        `cNode` - the class to add hashCode method to
        `cacheResult` - whether to cache the hash code in a field
        `includeFields` - whether to include fields in the hash code
        `callSuper` - whether to include superclass hash code
        `excludes` - property names to exclude
        `includes` - property names to include
        `allNames` - whether to include all names (including internal ones with '$')
        `allProperties` - whether to process all properties
        `pojo` - whether to treat as plain old Java object

    - #### public static void createHashCode(ClassNode cNode, boolean cacheResult, boolean includeFields, boolean callSuper, List<String> excludes, List<String> includes, boolean allNames, boolean allProperties, boolean pojo, boolean useGetter)

      Generates a hashCode method for the given class.

      Parameters:
        `cNode` - the class to add hashCode method to
        `cacheResult` - whether to cache the hash code in a field
        `includeFields` - whether to include fields in the hash code
        `callSuper` - whether to include superclass hash code
        `excludes` - property names to exclude
        `includes` - property names to include
        `allNames` - whether to include all names (including internal ones with '$')
        `allProperties` - whether to process all properties
        `pojo` - whether to treat as plain old Java object
        `useGetter` - whether to use getter methods instead of direct field access

    - #### public void visit(ASTNode[] nodes, SourceUnit source)