Annotation Type Value.Enclosing


  • @Documented
    @Target(TYPE)
    public static @interface Value.Enclosing
    This annotation could be applied to top level class which contains nested abstract value types to provide namespacing for the generated implementation classes. Immutable implementation classes will be generated as classes enclosed into special "umbrella" top level class, essentialy named after annotated class with "Immutable" prefix (prefix could be customized using Value.Style.typeImmutableEnclosing()). This could mix with Value.Immutable annotation, so immutable implementation class will contains nested immutable implementation classes.

    Implementation classes nested under top level class with "Immutable" prefix

    • Have simple names without "Immutable" prefix
    • Could be star-imported for easy clutter-free usage.

     @Value.Enclosing
     class GraphPrimitives {
       @Value.Immutable
       interface Vertex {}
       @Value.Immutable
       static class Edge {}
     }
     ...
     import ...ImmutableGraphPrimitives.*;
     ...
     Edge.builder().build();
     Vertex.builder().build();