|
Arch4J 1.1 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.arch4j.domain.Domain
This is the abstract
base class for all domain classes. It
provides a common interface to get and set the single Object
value represented by this domain value container. The Class
type of any specified Object
value for setting is automatically
validated against what the implementation class specifies as the expected
Class
type in getValueClass
. Additional validation
specific to bounds checking or business rules is coded in the implementation
class's validate
method.
Constructor Summary | |
Domain()
Constructs the domain and sets its value to null . |
|
Domain(Object aValue)
Constructs the domain and sets its value to the specified value. |
Method Summary | |
Object |
getValue()
Retrieve the value contained by this domain. |
protected abstract String |
getValueClass()
Placeholder for the implementation class to specify the String
representation of the class name expected for this domain's value. |
void |
setValue(Object aValue)
Sets the value contained by this domain. |
String |
toString()
Returns a String representation of this domain's value. |
protected abstract void |
validate(Object aValue)
Placeholder for any bounds checking and business rule validation. |
protected void |
validateType(Object aValue)
Validates the Class type of aValue . |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public Domain()
null
.
public Domain(Object aValue) throws DomainValidationException
Method Detail |
public Object getValue()
public void setValue(Object aValue) throws DomainValidationException
Class
type and any additional business validation is
automatically performed. If the specified value is null
, then
validation is skipped.
DomainValidationException
- if bounds or business rule validation is not met.protected void validateType(Object aValue)
Class
type of aValue
.
protected abstract void validate(Object aValue) throws DomainValidationException
DomainValidationException
- if any bounds checks or business rule validations fail.protected abstract String getValueClass()
String
representation of the class name expected for this domain's value.
This method will be used both in runtime value type checking and in
automating persistence from the database.
public String toString()
String
representation of this domain's value. If
the value is null
then return an empty string.
toString
in class Object
|
Arch4J 1.1 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |