public interface CMPField
This interface provides an alternative access mechanism to a single CMP field.
Modifier and Type | Method and Description |
---|---|
String |
getName()
Get the CMP field name.
|
Set<String> |
getTags()
Get the set of CMP field tags associated with this CMP field.
|
Class<?> |
getType()
Get the expected or current type of this CMP field.
|
<T> T |
getValue()
Get the value of this CMP field.
|
boolean |
hasValue()
Determine if this CMP field currently has a value.
|
boolean |
isPredefined()
Determine if this CMP field is defined in the SBB abstract class or any CMP extension interface.
|
void |
reset()
Reset this CMP field to its initial value.
|
<T> void |
setValue(T value)
Set the CMP field to the specified value.
|
String getName()
Get the CMP field name.
This method is a non-transactional method.
Class<?> getType()
Get the expected or current type of this CMP field. <p> If the CMP field is defined in the SBB abstract class or a CMP extension interface then the value returned from this method will be the declared class type. Otherwise the CMP field must be an arbitrary CMP field and the value returned will be the class type of the current value assigned to the CMP field, if any.
This method is a non-transactional method when invoked for a CMP field defined in the SBB abstract class or a CMP extension interface. It is a mandatory transactional method when invoked for an arbitrary CMP field.
null
if this CMP field is an arbitrary CMP field that has been set to null
.Set<String> getTags()
Get the set of CMP field tags associated with this CMP field.
This method is a non-transactional method.
<T> T getValue() throws ClassCastException
Get the value of this CMP field.
T
- the expected type of the value.null
if it currently has no value.ClassCastException
- if T
is not a compatible type for the field’s value.<T> void setValue(T value) throws NullPointerException, ClassCastException
Set the CMP field to the specified value.
T
- the value type.value
- the value. May be null
if the CMP field does not have a primitive type.NullPointerException
- if the CMP field was defined in the SBB abstract class or a CMP extension interface with a primitive type and value
is null
.ClassCastException
- if the CMP field was defined in the SBB abstract class or a CMP extension interface and the specified value is not a compatible type.boolean hasValue()
Determine if this CMP field currently has a value.
true
if this CMP field currently has a value, false
otherwise.
This method will always return true
for primitive type CMP fields defined in the SBB abstract class or a CMP extension interface.void reset()
Reset this CMP field to its initial value. The initial value for a CMP field is defined as follows:
If the CMP field was defined in the SBB abstract class or a CMP extension interface and has an @InitialValueField
annotation, then the CMP field is reset to the specified initial value.
If the CMP field was defined in the SBB abstract class or a CMP extension interface without an @InitialValueField
annotation, then the CMP field is reset to the default Java-defined initial value for that type, eg. 0 for numeric primitives, null
for object references.
Otherwise the named CMP field must be an arbitrary CMP field, and the CMP field is reset to null
.
boolean isPredefined()
Determine if this CMP field is defined in the SBB abstract class or any CMP extension interface.
This method is a non-transactional method.
true
if this CMP field is defined in the SBB abstract class or a CMP extension interface, false
otherwise, ie. it is an arbitrary CMP field.