public class SimpleDriveObject extends Object implements DriveObject
| Constructor and Description |
|---|
SimpleDriveObject(DriveObjectFactory factory)
Creates a new drive object
|
| Modifier and Type | Method and Description |
|---|---|
DriveElement |
get(String key)
Retrieves an item from the list
|
Boolean |
getAsBoolean() |
Character |
getAsChar() |
Double |
getAsDouble() |
DriveElement |
getAsElement() |
DriveElementArray |
getAsElementArray() |
Float |
getAsFloat() |
Integer |
getAsInt() |
Long |
getAsLong() |
DriveObject |
getAsObject() |
DriveObject |
getAsObject(String key)
Retrieves an item from the list
|
Short |
getAsShort() |
String |
getAsString() |
<T> T |
getAsTypedObject(Class<T> clazz)
Returns this object converted to an object of the specified type
|
Object |
getPrimitiveValue() |
HashMap<String,DriveElement> |
getSubComponents() |
boolean |
isEmpty()
Checks if this object is empty
|
void |
setObject(String key,
DriveElement element)
Writes an element to the list
|
void |
setPrimitive(String key,
Object object)
Writes an primitive element to the list
|
public SimpleDriveObject(DriveObjectFactory factory)
factory - the factory the object was created inpublic DriveElement get(String key)
get in interface DriveObjectkey - used to identify an itempublic DriveObject getAsObject(String key)
getAsObject in interface DriveObjectkey - used to identify an itempublic void setObject(String key, DriveElement element)
setObject in interface DriveObjectkey - key to affiliate the element withelement - element to storepublic void setPrimitive(String key, Object object)
setPrimitive in interface DriveObjectkey - key to affiliate the element withobject - primitive type objectpublic <T> T getAsTypedObject(Class<T> clazz) throws ClassCastException
getAsTypedObject in interface DriveObjectT - type to convert object toclazz - class to cast object toClassCastException - thrown if this object can not be converted into the specified object.public boolean isEmpty()
isEmpty in interface DriveObjectpublic Boolean getAsBoolean() throws ClassCastException, NotAPrimitiveTypeException
getAsBoolean in interface DriveElementBooleanClassCastException - thrown if the element is not that typeNotAPrimitiveTypeException - thrown if the element is not a primitive typepublic Short getAsShort() throws ClassCastException, NotAPrimitiveTypeException
getAsShort in interface DriveElementShortClassCastException - thrown if the element is not that typeNotAPrimitiveTypeException - thrown if the element is not a primitive typepublic Integer getAsInt() throws ClassCastException, NotAPrimitiveTypeException
getAsInt in interface DriveElementIntegerClassCastException - thrown if the element is not that typeNotAPrimitiveTypeException - thrown if the element is not a primitive typepublic Long getAsLong() throws ClassCastException, NotAPrimitiveTypeException
getAsLong in interface DriveElementLongClassCastException - thrown if the element is not that typeNotAPrimitiveTypeException - thrown if the element is not a primitive typepublic Character getAsChar() throws ClassCastException, NotAPrimitiveTypeException
getAsChar in interface DriveElementCharacterClassCastException - thrown if the element is not that typeNotAPrimitiveTypeException - thrown if the element is not a primitive typepublic String getAsString() throws ClassCastException, NotAPrimitiveTypeException
getAsString in interface DriveElementStringClassCastException - thrown if the element is not that typeNotAPrimitiveTypeException - thrown if the element is not a primitive typepublic Float getAsFloat() throws ClassCastException, NotAPrimitiveTypeException
getAsFloat in interface DriveElementFloatClassCastException - thrown if the element is not that typeNotAPrimitiveTypeException - thrown if the element is not a primitive typepublic Double getAsDouble() throws ClassCastException, NotAPrimitiveTypeException
getAsDouble in interface DriveElementDoubleClassCastException - thrown if the element is not that typeNotAPrimitiveTypeException - thrown if the element is not a primitive typepublic DriveObject getAsObject() throws ClassCastException
getAsObject in interface DriveElementDriveObjectClassCastException - thrown if the element is not that typepublic DriveElement getAsElement() throws ClassCastException
getAsElement in interface DriveElementDriveElementClassCastException - thrown if the element is not that typepublic DriveElementArray getAsElementArray() throws ClassCastException
getAsElementArray in interface DriveElementDriveElementArrayClassCastException - thrown if the element is not that typepublic Object getPrimitiveValue()
getPrimitiveValue in interface DriveElementpublic HashMap<String,DriveElement> getSubComponents()
getSubComponents in interface DriveElementCopyright © 2019. All rights reserved.