Annotation Type Encoding.Naming


  • @Target(METHOD)
    @Retention(SOURCE)
    public static @interface Encoding.Naming
    Many elements (but not all) supports customized naming patterns. Use single asterisk symbol in a name to denote a placeholder where attribute name would be insterted. We call namings of form "*" as identity naming, and the ones which have no placeholder, as in "set" - constant namings. Like "with*Added" for copy with addition method. Elements that can have customized naming:
    • Copy/With methods
    • Helper fields and methods
    • Builder attribute initializer
    • Helper fields and methods on builder

    As an alternative to specifying a pattern, you may want to reuse standard() naming.

    Please note, that with customized naming it is possible (but in general, not recommended) to put constant naming (without "*" placeholder) on elements. But when you do this it can result in name clashes in generated code.

    See Also:
    depluralize(), standard()
    • Optional Element Summary

      Optional Elements 
      Modifier and Type Optional Element Description
      boolean depluralize
      Set to true if depluralizer needs to kick in and try to convert attribute name to a singular form before applying pattern (value()).
      Encoding.StandardNaming standard
      Standard namings can be used to reuse standard styles, like the ones defined in Value.Immutable.Style for the custom-defined elements in encoding.
      java.lang.String value
      Naming pattern for element.
    • Element Detail

      • value

        java.lang.String value
        Naming pattern for element.
        Returns:
        naming pattern
        Default:
        "*"
      • depluralize

        boolean depluralize
        Set to true if depluralizer needs to kick in and try to convert attribute name to a singular form before applying pattern (value()). Some standard namings imply depluralization (Encoding.StandardNaming.ADD, Encoding.StandardNaming.PUT).
        Returns:
        if depluralized attribute name
        Default:
        false
      • standard

        Encoding.StandardNaming standard
        Standard namings can be used to reuse standard styles, like the ones defined in Value.Immutable.Style for the custom-defined elements in encoding. If Encoding.StandardNaming is used with the generator other than Immutables which do not have notion of namings/styles, then, typical default values will be used.
        Default:
        org.immutables.encode.Encoding.StandardNaming.NONE