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 |
add(DriveElement driveElement)
Adds drive elements together.
|
DriveObject |
deepClone()
Deep clones this element and returns the clone
|
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
|
DriveObject |
subtract(DriveElement driveElement)
Subtracts a Drive element from this element leaving only the difference
of this object compared to the parameter element.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetFactorypublic 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 DriveObject deepClone()
DriveElementdeepClone in interface DriveElementdeepClone in interface DriveObjectpublic DriveObject subtract(DriveElement driveElement)
DriveElementsubtract in interface DriveElementsubtract in interface DriveObjectdriveElement - the element to subtractpublic DriveElement add(DriveElement driveElement)
DriveElementadd in interface DriveElementdriveElement - the drive element to addpublic 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 © 2020. All rights reserved.