Annotation Type AlsoLoad


@Retention(RUNTIME) @Target({FIELD,PARAMETER}) public @interface AlsoLoad

Annotation which helps migrate schemas by loading one of several possible properties in the entity into fields or methods. This is typically used when a field is renamed, allowing the field to be populated by both its current name and any prior names.

  • When placed on a field, the additional names (entity properties) will be checked when this field is loaded. If the entity contains data for more than one of the names, an exception will be thrown.
  • When placed on a parameter to a method that takes a single parameter, the method will be called with the data value. As with fields, any ambiguity in the data (multiple properties that would cause the method to be called) will produce an exception. However, @AlsoLoad on a method parameter *can* be used to override field names and "steal" the value that would otherwise have been set on a field. This can be useful when changing the type of a field.
Author:
Jeff Schnitzer invalid input: '<'[email protected]>
  • Required Element Summary

    Required Elements
    Modifier and Type
    Required Element
    Description
     
  • Element Details