Annotation Interface AutoCreate


Auto create the object of this field, if still null during the auto create phase. The value must be a literal Map containing the values to be passed to the create method.

For keyed fields, the key must be passed as key() parameter. Additionally, the concrete type of the object to be created can be passed as type() parameter. If the annotated field is an abstract type, the type parameter is mandatory.

When placed on a field of type closure, the behavior is slightly different. In that case, the closure is called during the lifecycle phase.

AutoCreate can also be used on methods. In that case, the method is handled as a regular lifecycle method.

If AutoCreate is placed on a Cluster field, all matching fields of the cluster auto created, as if the annotation was placed on each of them.

  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static class 
    Marker class for default value.
  • Optional Element Summary

    Optional Elements
    Modifier and Type
    Optional Element
    Description
     
     
    Class<? extends groovy.lang.Closure<Map<String,Object>>>
    Closure that contains exactly one Map literal, which is passed to the create method as named parameters.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
     
  • Field Details

  • Element Details

    • value

      Class<? extends groovy.lang.Closure<Map<String,Object>>> value
      Closure that contains exactly one Map literal, which is passed to the create method as named parameters.
      Default:
      com.blackbuild.klum.ast.layer3.AutoCreate.None.class
    • key

      String key
      Default:
      "$default"
    • type

      Class<?> type
      Default:
      java.lang.Object.class