public abstract class DomainObject extends Object
public void setLastName(String lastName) throws MutatorException { this.lastName = ensureNotNull(lastName, "Last Name"); }
Constructor and Description |
---|
DomainObject()
Construct a new
DomainObject . |
Modifier and Type | Method and Description |
---|---|
double |
ensureNonNegative(double value,
String desc)
Ensure that a double precision value is greater than or equal to zero.
|
float |
ensureNonNegative(float value,
String desc)
Ensure that a floating point value is greater than or equal to zero.
|
int |
ensureNonNegative(int value,
String desc)
Ensure that an integer value is greater than or equal to zero.
|
String |
ensureNotNull(String value,
String desc)
Ensure that a String is neither null nor of length zero.
|
double |
ensurePositive(double value,
String desc)
Ensure that a double precision value is greater than zero.
|
float |
ensurePositive(float value,
String desc)
Ensure that a floating point value is greater than zero.
|
int |
ensurePositive(int value,
String desc)
Ensure that an integer value is greater than zero.
|
private static void |
negativeWarning(String fieldName) |
private static void |
nullWarning(String fieldName) |
private static void |
positiveWarning(String fieldName) |
private static void |
selectionWarning(String fieldName) |
protected String |
trapNull(String s)
Ensure that a String value is not
null . |
public DomainObject()
DomainObject
.protected String trapNull(String s)
null
.s
- The string check.s
is null
,
and s
otherwise.public int ensurePositive(int value, String desc) throws MutatorException
value
- The value to check.desc
- A description of the field that this value represents.MutatorException
- If the validation fails.public float ensurePositive(float value, String desc) throws MutatorException
value
- The value to check.desc
- A description of the field that this value represents.MutatorException
- If the validation fails.public double ensurePositive(double value, String desc) throws MutatorException
value
- The value to check.desc
- A description of the field that this value represents.MutatorException
- If the validation fails.public int ensureNonNegative(int value, String desc) throws MutatorException
value
- The value to check.desc
- A description of the field that this value represents.MutatorException
- If the validation fails.public float ensureNonNegative(float value, String desc) throws MutatorException
value
- The value to check.desc
- A description of the field that this value represents.MutatorException
- If the validation fails.public double ensureNonNegative(double value, String desc) throws MutatorException
value
- The value to check.desc
- A description of the field that this value represents.MutatorException
- If the validation fails.public String ensureNotNull(String value, String desc) throws MutatorException
value
- The value to check.desc
- A description of the field that this value represents.MutatorException
- If the validation fails.private static void nullWarning(String fieldName) throws MutatorException
MutatorException
private static void positiveWarning(String fieldName) throws MutatorException
MutatorException
private static void negativeWarning(String fieldName) throws MutatorException
MutatorException
private static void selectionWarning(String fieldName) throws MutatorException
MutatorException
WebARTS Library Licensed Under the GNU - General Public License. Other Libraries licensed under their respective Open Source Licenses