Classes annotated by
CustomLabel
automatically implement
CustomLabeled
.
CustomLabeled.getCustomLabel()
is implemented by traversing the fields which are annotated by
LabelPart
. If
no field is annotated by
LabelPart
all the fields are considered while building the custom label.
The generation of a
getCustomLabel()
is omitted if the method is already defined
explicitly.
Usage example:
@CustomLabel
class MyObject {
@LabelPart
String attribute1
String attribute2
}
Leads to:
public class MyObject implements CustomLabeled {
@LabelPart
private String attribute1;
private String attribute2;
@Override
public String getCustomLabel( ) {
final CustomLabelStringBuilder b = new CustomLabelStringBuilder( this );
b.add( "attribute1", this.attribute1 );
return b.toString( );
}
}