| Modifier and Type | Optional Element and Description |
|---|---|
String |
alias
An alternative name for the property.
|
String |
builderType
The exposed type of the property in the builder and associated constructor.
|
String |
equalsHashCodeStyle
The configuration for equals and hash code.
|
String |
get
The style of the method used to query the property.
|
boolean |
overrideGet
Whether the generated getter should be declared with the
Override annotation. |
boolean |
overrideSet
Whether the generated setter should be declared with the
Override annotation. |
String |
set
The style of the method used to mutate the property.
|
String |
toStringStyle
The configuration for toString.
|
String |
type
The exposed type of the property.
|
String |
validate
The validator to use.
|
public abstract String alias
The property can be looked up using the specified alias.
The primary name is unaffected, and the alias is only used in certain circumstances.
For example, bean.metaProperty("alias") and bean.property("alias")
will both work, as will getting and setting via an immutable bean builder.
This attribute is most useful in handling change from serialized forms.
public abstract String get
The style is a string describing the getter, typically used for code generation.
By default this is 'smart' which will use the source code knowledge to determine
what to generate. This will be a method of the form isXxx() for boolean
and getXxx() for all other types.
Supported style strings are:
Optional wrapper around the field,
where the field itself is nullable instead of optional. OptionalDouble, OptionalInt
and OptionalLong are also handled
Optional wrapper around the field,
where the field itself is nullable instead of optional
public abstract String set
The style is a string describing the mutator, typically used for code generation.
By default this is 'smart' which will use the source code knowledge to determine
what to generate. This will be a method of the form setXxx() for all types unless
the field is final. If the field is a final Collection or Map
of a known type then a set method is generated using addAll or puAll
Standard style strings are:
PropertyChangeSupport
A pattern can be used for special behaviour.
The pattern is a complete piece of code.
For example, 'new Foo($value)' or '$field = $value.clone()'.
'$field' for the field to copy into.
'$value' for the value to copy from.
'<>' for the generics of the type including angle brackets.
'\n' for a new line (all lines must then include semi-colons).
public abstract boolean overrideGet
Override annotation.
By default, the annotation is not added.
public abstract boolean overrideSet
Override annotation.
By default, the annotation is not added.
public abstract String type
The style is used to control the exposed type of the property in getters and setters, or similar.
This is used when the type of the field is not the same as the type that should be used in public methods such as getters and setters.
By default, the declared type will be used as the exposed type.
public abstract String builderType
The style is used to control the exposed type of the property in immutable builders and associated constructors, or similar.
This is used when the type of the field is not the same as the type that should be used in public methods such as builder setters.
By default, the declared type will be used as the exposed type.
This is typically used to add '? extends' to collection types.
public abstract String equalsHashCodeStyle
This flag controls generation of the equals and hashCode methods.
The default is 'smart'.
Standard strings are:
public abstract String toStringStyle
This flag controls generation of the toString method.
The default is 'smart'.
Standard strings are:
public abstract String validate
The property value may be validated by specifying this attribute. By default no validation is performed. The code generator places the validation into the set method and ensures that new objects are validated correctly.
Custom validations, are written by writing a static method and referring to it.
For example, public void checkMyValue(Integer val, String propertyName) ...
The method generally has a void return, throwing an exception if validation fails.
There must be two arguments, the value and the property name. The value may be the
property type or a superclass (like Object). The property name should be a String.
Standard validation strings are:
Copyright © 2007–2017 Joda.org. All rights reserved.