public interface Entity
Interface that describes a specific instance of a EntityClass
.
All entities objects share two common methods to retrieve full and partial EntityKeys, in additions to inherithed methods from EntityClass.
All other specific fields of each entity are available as specific fields of the correspinding Java object that implements this interface.
Field Summary |
---|
Fields inherited from interface EntityClass |
---|
TYPE_ENTITY, TYPE_ENUM |
Method Summary | |
---|---|
Object |
clone()
Implement Cloneable interface. |
Object |
getField(String fieldName)
Returns a field value of this Entity. |
EntityKey |
getFullEntityKey(int keyID)
Returns a given full EntityKey of this Entity. |
EntityKey |
getPartialEntityKey(int keyID,
int numSegments)
Returns a given partial EntityKey of this Entity. |
void |
setField(String fieldName,
Object value)
Set a field value of this Entity. |
Methods inherited from interface EntityClass |
---|
getEntityClassID, getEntityClassName, getEntityFields, getNumSegments, getType, isKey, isKey, makeEntity |
Method Detail |
---|
EntityKey getFullEntityKey(int keyID)
Please note:
getFullEntityKey(keyID) == getPartialEntityKey(keyID, getNumSegments(keyID))
keyID
- the index of a key of this class.
null
is returned when the given keyID
does not refer to a valid key for the EntityClass
of this
Entity.EntityKey getPartialEntityKey(int keyID, int numSegments)
keyID
- the index of a key of this class.numSegments
- number of initial segments that must be present in the partial
key.
null
is returned when the given keyID
does not refer to a valid key for the EntityClass
of this
Entity, numSegments
parameter is <=0
or > getNumSegments(keyID).Object getField(String fieldName) throws NullPointerException, IllegalArgumentException
Please note:
- to get array value at index i use "fieldname[i]"
- for nested entity field use "." as separator
For primitive value, it returns the Object corresponding to it
(e.g. int
as returned as Integer
).
fieldName
- the name of the field.
null
is returned when the given fieldName
does not refer to a valid field for the EntityClass
of this
Entity.
IllegalArgumentException
- if the field name is not valid.
NullPointerException
void setField(String fieldName, Object value) throws NullPointerException, IllegalArgumentException, ClassCastException
fieldName
- the name of the field.value
- the Object value of the field.
IllegalArgumentException
- if the field name is not valid.
ClassCastException
- if the Object value type is not valid.
NullPointerException
getField(java.lang.String)
Object clone() throws CloneNotSupportedException
CloneNotSupportedException