Annotation Type val


  • @Target(FIELD)
    @Retention(CLASS)
    public @interface val
    Designates a field declaration as a read-only property.

    
     @val String name; // a public read-only property
     
    You use the property directly as declared:

    
     String theName = foo.name; // compiles as a call to foo.getName()
     
    When used in an interface the property is public and abstract, a public getter is generated. If the property is initialized, the getter is default and returns the initialized value.

    When used in a class the property is public by default, a private final backing field is generated having the same name, and a public getter is generated returning the field. The property must be initialized either in its declaration or in the constructor(s).

    A property can be declared with static. When used in a class, the same rules apply as non-static. Static interface properties, however, must always be calculated -- getter/setter methods must be provided.

    Note, the final and abstract modifiers can be used in a property declaration; they apply to the getter/setter accessor methods. Thus, if there are user-defined getter/setter methods corresponding with the property, they must reflect the modifiers from the property.

    See Also:
    get, set
    • Optional Element Summary

      Optional Elements 
      Modifier and Type Optional Element Description
      manifold.rt.api.anno.any[] annos
      Use this argument to specify annotations to apply to the val's generated getter method.
      PropOption[] value
      Access options to override the property field's declared access.
    • Element Detail

      • value

        PropOption[] value
        Access options to override the property field's declared access. Note, favor Java modifiers for properties over PropOption annotation arguments. As such, the only necessary option is PropOption.Package to override the default public nature of properties. Otherwise, you don't need to use this argument.
        Default:
        {}
      • annos

        manifold.rt.api.anno.any[] annos
        Use this argument to specify annotations to apply to the val's generated getter method.
        Default:
        {}