Package manifold.ext.props.rt.api
Annotation Type var
-
@Target(FIELD) @Retention(CLASS) public @interface var
Designates a field declaration as a read-write property.
You use the property directly as declared:@var String name; // a public read-write property
When used in an interface the property is public and abstract, public getter/setter method are generated. When used in a class the property is public by default, a private final backing field is generated having the same name, a public getter is generated returning the field and a setter is generated assigning the parameter value to the field. A property can be declared withfoo.name = "Scott"; // compiles as a call to foo.setName("Scott") String theName = foo.name; // compiles as a call to foo.getName()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, thefinalandabstractmodifiers 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. You can usegetandsetalong with {@link var} to override the modifiers declared on it:@var @set(Protected) String name; // declares public read access and protected write access
-
-
Optional Element Summary
Optional Elements Modifier and Type Optional Element Description manifold.rt.api.anno.any[]annosUse this argument to specify annotations to apply to the var's generated getter/setter methods.manifold.rt.api.anno.any[]paramUse this argument to specify annotations to apply to the var's generated setter parameter.PropOption[]valueAccess 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:
- {}
-
-