@Documented @Retention(value=RUNTIME) @Target(value=METHOD) public @interface PluralOf
XmlElement
annotation
on it
The rules for determining the singular form of the element name is the following:
For example, if the method name is getDoctors, the singular element name will be "doctor". In that case the adder method will be addDoctor, the remover method will be removeDoctor and the lookup method will be lookupDoctor. In some cases the singular of a word is the same as the plural. If that word does not end in s the default behavior works fine. For example if the method name is getMoose, the singular element name will be "moose". The adder method will be addMoose and so on.
In cases that do not conform to the above rule this annotation is provided, which allows the
user to specify what this element name is the plural of. For example, if the method
name is getMice then this annotation should be used:
VPluralOf("mouse")
In this case the adder method will become addMouse, the remover will be removeMouse and the
lookup will be lookupMouse.
This annotation can also be used to specify the exact method name that should be used for the adder, remover and lookup. If those fields are filled in the will override the algorithm for determining the singular for this element name.
Modifier and Type | Fields and Description |
---|---|
static String |
USE_NORMAL_PLURAL_PATTERN
This value is used to indicate that the normal
algorithm should be used for determining the
singular of the element name
|
Modifier and Type | Optional Element and Description |
---|---|
String |
add
Returns the exact name of the method that should be
used as the adder for this element
|
String |
lookup
Returns the exact name of the method that should be
used as the lookkup for this element
|
String |
remove
Returns the exact name of the method that should be
used as the remover for this element
|
String |
value
Returns the singular of the element name described by this
setter or getter method.
|
public static final String USE_NORMAL_PLURAL_PATTERN
public abstract String value
For example, if this is returning the singular for "mice", it should return "Mouse".
USE_NORMAL_PLURAL_PATTERN
if the
normal algorithm should be appliedpublic abstract String add
USE_NORMAL_PLURAL_PATTERN
if
the normal algorithm should be used (as modified
by the value()
method)public abstract String remove
USE_NORMAL_PLURAL_PATTERN
if
the normal algorithm should be used (as modified
by the value()
method)public abstract String lookup
USE_NORMAL_PLURAL_PATTERN
if
the normal algorithm should be used (as modified
by the value()
method)Copyright © 2009–2023 Oracle Corporation. All rights reserved.