public class DataObject extends Object implements DataUnit
getNew() will use the Reflection API to attempt to create a new instance of the object via a public default constructor. If successful, the object created will be returned.
getCopy() will call first call getNew() and then invoke copyFrom() on the created object passing it this object as a parameter.
copyFrom(Object other) envokes the eve.util.Utils.copy(Object source,Object dest) with this as the destination and the "other"
compareTo() returns 0 if the two Objects are the same object, or 1 otherwise.
equals() returns true if compareTo() returns 0.
Constructor and Description |
---|
DataObject() |
Modifier and Type | Method and Description |
---|---|
Class |
_getFieldType(String name) |
boolean |
_getSetField(String name,
Wrapper data,
boolean isGet)
This is used for data transfer using a eve.data.FieldTransfer object.
|
void |
cache()
Put this object into a cache of re-usable objects.
|
int |
compareTo(Object other)
Compare this object with another.
|
protected void |
copied(Object from)
This method is called after the base implementation of copyFrom() is executed.
|
void |
copyFrom(Object other)
Copy all appropriate data from another object.
|
boolean |
equals(Object other)
Returns if this object is considered equal to the other object.
|
Object |
getCopy()
Return a copy of this object.
|
Field |
getDeclaredField(String fieldName,
String baseClassName)
Get a declared field for this object for the specified baseClassName.
|
Object |
getDeclaredFieldValue(String fieldName,
String baseClassName)
Get the value of a declared field in a Wrapper object.
|
String |
getMyFieldList(String baseClassName)
Gets the declared field list for a particular class in the class hierarchy of this LiveObject.
|
Object |
getNew()
Return a new Object which is of the same class as the original.
|
public Object getCopy()
Copyable
public void copyFrom(Object other)
DataUnit
public int compareTo(Object other)
Comparable
compareTo
in interface Comparable
public boolean equals(Object other)
Object
public Object getNew()
DataUnit
public boolean _getSetField(String name, Wrapper data, boolean isGet)
By default this method calls PropertyList.getSetProperties() on this Object.
name
- the field name.data
- a non-null Wrapper that receives or provides the field data.isGet
- if this is true then it is a get operation (in which case you should set
the value of data to be the field value) if it is false it is a set operation and
the value of data should be assigned to the field.public String getMyFieldList(String baseClassName) throws IllegalArgumentException
baseClassName
- This should be the last part of the class name or the fully qualified class name.
For example if the object is of type samples.data.PersonInfo, the baseClassName can be "PersonInfo".IllegalArgumentException
- If the baseClassName does not appear in the class hierarchy.public Field getDeclaredField(String fieldName, String baseClassName) throws IllegalArgumentException
fieldName
- The fieldNamebaseClassName
- This should be the last part of the class name or the fully qualified class name.
For example if the object is of type samples.data.PersonInfo, the baseClassName can be "PersonInfo".IllegalArgumentException
- If the baseClassName does not appear in the class hierarchy.public Object getDeclaredFieldValue(String fieldName, String baseClassName) throws IllegalArgumentException
fieldName
- The fieldNamebaseClassName
- This should be the last part of the class name or the fully qualified class name.
For example if the object is of type samples.data.PersonInfo, the baseClassName can be "PersonInfo".IllegalArgumentException
- If the baseClassName does not appear in the class hierarchy.public void cache()
protected void copied(Object from)
from
- The object that data was copied from.