Package: org.grails.compiler.injection

## [Java] Class DefaultGrailsDomainClassInjector

- org.grails.compiler.injection.DefaultGrailsDomainClassInjector

- All Implemented Interfaces and Traits:
    GrailsArtefactClassInjector, GrailsDomainClassInjector

      @AstTransformer
      public class DefaultGrailsDomainClassInjector
      extends java.lang.Object
      implements GrailsArtefactClassInjector, GrailsDomainClassInjector

  Default implementation of domain class injector interface that adds the 'id' and 'version' properties and other previously boilerplate code.

  Authors:
    Graeme Rocher
  Since:
    0.2

- - ### Field Summary

    Fields
    Modifiers | Name | Description
    --- | --- | ---
    `private java.util.List<org.codehaus.groovy.ast.ClassNode>` | `classesWithInjectedToString` |

  - ### Methods Summary

    Methods
    Type Params | Return Type | Name and description
    --- | --- | ---
    `` | `private void` | `addAssociationForKey(java.lang.String key, java.util.List<org.codehaus.groovy.ast.PropertyNode> properties, org.codehaus.groovy.ast.ClassNode declaringType, org.codehaus.groovy.ast.ClassNode propertyType)`
    `` | `private java.util.Collection<org.codehaus.groovy.ast.PropertyNode>` | `createPropertiesForBelongsToOrHasOneExpression(org.codehaus.groovy.ast.expr.Expression e, org.codehaus.groovy.ast.ClassNode classNode)`
    `` | `private java.util.List<org.codehaus.groovy.ast.PropertyNode>` | `createPropertiesForHasManyExpression(org.codehaus.groovy.ast.expr.Expression e, org.codehaus.groovy.ast.ClassNode classNode)`
    `` | `private org.codehaus.groovy.ast.ClassNode` | `findPropertyType(org.codehaus.groovy.ast.expr.Expression expression)` Finds the type of the generated property.
    `` | `public java.lang.String[]` | `getArtefactTypes()`
    `` | `private java.lang.String` | `getMappingFileName(java.lang.String className)` Returns the ORM framework's mapping file name for the specified class name.
    `` | `private void` | `injectAssociationProperties(org.codehaus.groovy.ast.ClassNode classNode, java.util.List<org.codehaus.groovy.ast.PropertyNode> propertiesToAdd)`
    `` | `private void` | `injectAssociations(org.codehaus.groovy.ast.ClassNode classNode)`
    `` | `private void` | `injectIdProperty(org.codehaus.groovy.ast.ClassNode classNode)`
    `` | `private void` | `injectToStringMethod(org.codehaus.groovy.ast.ClassNode classNode)`
    `` | `private void` | `injectVersionProperty(org.codehaus.groovy.ast.ClassNode classNode)`
    `` | `private boolean` | `isEnum(org.codehaus.groovy.ast.ClassNode classNode)`
    `` | `public void` | `performInjection(org.codehaus.groovy.control.SourceUnit source, org.codehaus.groovy.classgen.GeneratorContext context, org.codehaus.groovy.ast.ClassNode classNode)`
    `` | `public void` | `performInjection(org.codehaus.groovy.control.SourceUnit source, org.codehaus.groovy.ast.ClassNode classNode)`
    `` | `public void` | `performInjectionOnAnnotatedClass(org.codehaus.groovy.control.SourceUnit source, org.codehaus.groovy.ast.ClassNode classNode)`
    `` | `public void` | `performInjectionOnAnnotatedEntity(org.codehaus.groovy.ast.ClassNode classNode)`
    `` | `public boolean` | `shouldInject(java.net.URL url)`
    `` | `protected boolean` | `shouldInjectClass(org.codehaus.groovy.ast.ClassNode classNode)`

  - ### Inherited Methods Summary

    Inherited Methods
    Methods inherited from class | Name
    --- | ---
    `class java.lang.Object` | `java.lang.Object#wait(long), java.lang.Object#wait(long, int), java.lang.Object#wait(), java.lang.Object#equals(java.lang.Object), java.lang.Object#toString(), java.lang.Object#hashCode(), java.lang.Object#getClass(), java.lang.Object#notify(), java.lang.Object#notifyAll()`

- - ### Field Detail

    - #### private java.util.List<org.codehaus.groovy.ast.ClassNode> classesWithInjectedToString

  - ### Method Detail

    - #### private void addAssociationForKey(java.lang.String key, java.util.List<org.codehaus.groovy.ast.PropertyNode> properties, org.codehaus.groovy.ast.ClassNode declaringType, org.codehaus.groovy.ast.ClassNode propertyType)

    - #### private java.util.Collection<org.codehaus.groovy.ast.PropertyNode> createPropertiesForBelongsToOrHasOneExpression(org.codehaus.groovy.ast.expr.Expression e, org.codehaus.groovy.ast.ClassNode classNode)

    - #### private java.util.List<org.codehaus.groovy.ast.PropertyNode> createPropertiesForHasManyExpression(org.codehaus.groovy.ast.expr.Expression e, org.codehaus.groovy.ast.ClassNode classNode)

    - #### private org.codehaus.groovy.ast.ClassNode findPropertyType(org.codehaus.groovy.ast.expr.Expression expression)

      Finds the type of the generated property. The type will be a java.util.Set that is parameterized by the type of the expression passed in.

      Parameters:
        `expression` - the expression used to parameterize the java.util.Set. Only used if a org.codehaus.groovy.ast.expr.ClassExpression. Otherwise ignored.
      Returns:
        A org.codehaus.groovy.ast.ClassNode of type java.util.Set that is possibly parameterized by the expression that is passed in.

    - #### public java.lang.String[] getArtefactTypes()

    - #### private java.lang.String getMappingFileName(java.lang.String className)

      Returns the ORM framework's mapping file name for the specified class name.

      Parameters:
        `className` - The class name of the mapped file
      Returns:
        The mapping file name

    - #### private void injectAssociationProperties(org.codehaus.groovy.ast.ClassNode classNode, java.util.List<org.codehaus.groovy.ast.PropertyNode> propertiesToAdd)

    - #### private void injectAssociations(org.codehaus.groovy.ast.ClassNode classNode)

    - #### private void injectIdProperty(org.codehaus.groovy.ast.ClassNode classNode)

    - #### private void injectToStringMethod(org.codehaus.groovy.ast.ClassNode classNode)

    - #### private void injectVersionProperty(org.codehaus.groovy.ast.ClassNode classNode)

    - #### private boolean isEnum(org.codehaus.groovy.ast.ClassNode classNode)

    - #### public void performInjection(org.codehaus.groovy.control.SourceUnit source, org.codehaus.groovy.classgen.GeneratorContext context, org.codehaus.groovy.ast.ClassNode classNode)

    - #### public void performInjection(org.codehaus.groovy.control.SourceUnit source, org.codehaus.groovy.ast.ClassNode classNode)

    - #### public void performInjectionOnAnnotatedClass(org.codehaus.groovy.control.SourceUnit source, org.codehaus.groovy.ast.ClassNode classNode)

    - #### public void performInjectionOnAnnotatedEntity(org.codehaus.groovy.ast.ClassNode classNode)

    - #### public boolean shouldInject(java.net.URL url)

    - #### protected boolean shouldInjectClass(org.codehaus.groovy.ast.ClassNode classNode)