Annotation Type Value.Parameter

Enclosing class:
Value

@Documented @Target({METHOD,PARAMETER}) public static @interface Value.Parameter
Works with Value.Immutable classes to mark abstract accessor method be included as "of(..)" constructor parameter.

Following rules applies:

  • No constructor generated if none of methods have Value.Parameter annotation
  • For object to be constructable with a constructor - all non-default and non-derived attributes should be annotated with Value.Parameter.
  • Optional Element Summary

    Optional Elements
    Modifier and Type
    Optional Element
    Description
    int
    Used to specify order of constructor argument.
    boolean
    Specify as false to cancel out parameter: an attribute would not be considered as a parameter.
  • Element Details

    • order

      int order
      Used to specify order of constructor argument. It defaults to zero and allows for non-contiguous order values (arguments are sorted ascending by this order value).

      This attribute was introduced as potentially not all annotation processors could use source order of elements, i.e. order of declaration appearance in a source file. To support portable constructor argument definitions, developer should supply argument order explicitly. As of version 1.0, we implemented workaround for the Eclipse compiler, so it is not strictly needed to specify order, but it still might be needed if you wish to reorder arguments Since 2.5.6 the default value was changed to -1 to signify unspecified order, but the logic behind should not result in any practical incompatibilities.

      Returns:
      order
      Default:
      -1
    • value

      boolean value
      Specify as false to cancel out parameter: an attribute would not be considered as a parameter. This is useful to override the effect of Value.Style.allParameters() flag. By default it is true and should be omitted.
      Returns:
      false if not a parameter
      Default:
      true