public class SimpleElementArray extends Object implements DriveElementArray
DriveElementArray| Constructor and Description |
|---|
SimpleElementArray(DriveObjectFactory factory)
Creates a new empty element array
|
| Modifier and Type | Method and Description |
|---|---|
DriveElement |
add(DriveElement driveElement)
Adds drive elements together.
|
void |
addObject(DriveElement element)
Adds an element to the end of the array
|
void |
addObject(int num,
DriveElement element)
Writes an element to the list
|
void |
addPrimitive(int num,
Object object)
Writes an primitive element to the list
|
void |
addPrimitive(Object object)
Adds an primitive element to the end of the array
|
DriveElementArray |
deepClone()
Deep clones this element and returns the clone
|
DriveElement |
get(int num)
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(int num)
Retrieves an item from the list
|
Short |
getAsShort() |
String |
getAsString() |
<T> List<T> |
getAsTypedList(Class<T> clazz)
Returns this object converted to an object of the specified type
|
List<DriveElement> |
getContents()
Returns all contents as a mutable list
|
Object |
getPrimitiveValue() |
int |
getSize() |
HashMap<String,DriveElement> |
getSubComponents() |
DriveElementArray |
subtract(DriveElement driveElement)
Subtracts a Drive element from this element leaving only the difference
of this object compared to the parameter element.
|
public SimpleElementArray(DriveObjectFactory factory)
factory - factory that created this objectpublic DriveElement get(int num)
get in interface DriveElementArraynum - used to identify an itempublic DriveObject getAsObject(int num)
getAsObject in interface DriveElementArraynum - used to identify an itempublic void addObject(int num,
DriveElement element)
addObject in interface DriveElementArraynum - position to insert atelement - element to storepublic void addPrimitive(int num,
Object object)
throws NotAPrimitiveTypeException
addPrimitive in interface DriveElementArraynum - position to insert atobject - primitive type objectNotAPrimitiveTypeException - thrown if object parameter is not a primitive typepublic <T> List<T> getAsTypedList(Class<T> clazz) throws ClassCastException
getAsTypedList in interface DriveElementArrayT - type to convert object toclazz - type to convert object toClassCastException - thrown if this object can not be converted into the specified object.public List<DriveElement> getContents()
getContents in interface DriveElementArraypublic void addObject(DriveElement element)
addObject in interface DriveElementArrayelement - element to be addedpublic void addPrimitive(Object object) throws NotAPrimitiveTypeException
addPrimitive in interface DriveElementArrayobject - element to be addedNotAPrimitiveTypeException - thrown if object parameter is not a primitive typepublic 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 DriveElementpublic DriveElementArray subtract(DriveElement driveElement)
DriveElementsubtract in interface DriveElementsubtract in interface DriveElementArraydriveElement - the element to subtractpublic int getSize()
getSize in interface DriveElementArraypublic DriveElement add(DriveElement driveElement)
DriveElementadd in interface DriveElementdriveElement - the drive element to addpublic DriveElementArray deepClone()
DriveElementdeepClone in interface DriveElementdeepClone in interface DriveElementArrayCopyright © 2020. All rights reserved.