Package com.storedobject.core
Class ObjectText<T extends StoredObject>
java.lang.Object
com.storedobject.core.ObjectText<T>
- Type Parameters:
T- Type of object class.
- All Implemented Interfaces:
Storable
Definition of a type that can be used as an attribute in
StoredObject class. This type represents an instance
of a StoredObject that may or may not exist. If the instance exists, the instance Id is available
and the instance can be retrieved from the database. If not, a text representation of the instance (that may be
created at a later stage) will be available.-
Constructor Summary
ConstructorsConstructorDescriptionConstructor.ObjectText(Id id) Constructor.ObjectText(ObjectText<T> objectText) Construct from another instance.ObjectText(String text) Constructor.ObjectText(T object) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionstatic <O extends StoredObject>
ObjectText<O> Create an instance from an instance of theStoredObject.booleangetId()Get theIdvalue.Get the object value.Get the storable value.getText()Get the text value.booleanisEmpty()Is this an empty value (No object value is set and no text value is set).voidSet theIdvalue.voidSet the object value.voidSet a text value.toString()
-
Constructor Details
-
ObjectText
public ObjectText()Constructor. -
ObjectText
-
ObjectText
-
ObjectText
-
ObjectText
Construct from another instance. (Copy constructor).- Parameters:
objectText- Another instance.
-
-
Method Details
-
create
Create an instance from an instance of theStoredObject.- Type Parameters:
O- Type of instance.- Parameters:
value-StoredObjectinstance for which an instance needs to be created.- Returns:
- Instance of this type created from the value passed.
-
setId
-
setObject
-
setText
-
getStorableValue
Description copied from interface:StorableGet the storable value. By default,Object.toString()is returned.- Specified by:
getStorableValuein interfaceStorable- Returns:
- Storable value as a string.
-
equals
-
getId
-
getObject
-
getText
Get the text value.- Returns:
- It will be
nullif the object value is already available.
-
toString
-
isEmpty
public boolean isEmpty()Is this an empty value (No object value is set and no text value is set).- Returns:
- True or false.
-