cc.plural.jsonij
Class ArrayImp<E extends Value>

java.lang.Object
  extended by cc.plural.jsonij.Value
      extended by cc.plural.jsonij.ArrayImp<E>
All Implemented Interfaces:
Serializable, Comparable<Value>, Iterable<E>, Collection<E>, List<E>
Direct Known Subclasses:
JSON.Array

public class ArrayImp<E extends Value>
extends Value
implements List<E>

JSON Array Implementation.

Version:
1.0.0
Author:
J.W.Marsden
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class cc.plural.jsonij.Value
Value.TYPE
 
Field Summary
protected  List<E> arrayValue
          Array Contents Holder
 
Fields inherited from class cc.plural.jsonij.Value
valueType
 
Constructor Summary
ArrayImp()
           
 
Method Summary
 boolean add(E e)
           
 void add(int index, E element)
           
 boolean addAll(Collection<? extends E> c)
           
 boolean addAll(int index, Collection<? extends E> c)
           
 void clear()
           
 boolean contains(Object o)
           
 boolean containsAll(Collection<?> c)
           
 E get(int index)
          Extracts a Value instance at an Index.
 int indexOf(Object o)
           
protected  Value.TYPE internalType()
          Internal Method to find the internalType for the Object.
 boolean isEmpty()
           
 Iterator<E> iterator()
           
 int lastIndexOf(Object o)
           
 ListIterator<E> listIterator()
           
 ListIterator<E> listIterator(int index)
           
 int nestedSize()
          Finds the nested elements under this Value.
 E remove(int index)
           
 boolean remove(Object o)
           
 boolean removeAll(Collection<?> c)
           
 boolean retainAll(Collection<?> c)
           
 E set(int index, E element)
           
 int size()
          Retrieves the size of the Value.
 List<E> subList(int fromIndex, int toIndex)
           
 Object[] toArray()
           
<T> T[]
toArray(T[] a)
           
 String toJSON()
          Converts the current Value into a JSON String that represents it.
 
Methods inherited from class cc.plural.jsonij.Value
compareTo, equals, get, getBoolean, getDouble, getInt, getNumber, getString, getValueType, has, hashCode, isNull, toString, type, valueKeySet
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.List
equals, hashCode
 

Field Detail

arrayValue

protected List<E extends Value> arrayValue
Array Contents Holder

Constructor Detail

ArrayImp

public ArrayImp()
Method Detail

internalType

protected Value.TYPE internalType()
Description copied from class: Value
Internal Method to find the internalType for the Object. Must be implemented and not return null.

Specified by:
internalType in class Value
Returns:
The internalType of this JSON Value.

add

public boolean add(E e)
Specified by:
add in interface Collection<E extends Value>
Specified by:
add in interface List<E extends Value>

add

public void add(int index,
                E element)
Specified by:
add in interface List<E extends Value>

addAll

public boolean addAll(Collection<? extends E> c)
Specified by:
addAll in interface Collection<E extends Value>
Specified by:
addAll in interface List<E extends Value>

addAll

public boolean addAll(int index,
                      Collection<? extends E> c)
Specified by:
addAll in interface List<E extends Value>

clear

public void clear()
Specified by:
clear in interface Collection<E extends Value>
Specified by:
clear in interface List<E extends Value>

contains

public boolean contains(Object o)
Specified by:
contains in interface Collection<E extends Value>
Specified by:
contains in interface List<E extends Value>

containsAll

public boolean containsAll(Collection<?> c)
Specified by:
containsAll in interface Collection<E extends Value>
Specified by:
containsAll in interface List<E extends Value>

get

public E get(int index)
Description copied from class: Value
Extracts a Value instance at an Index. This method only returns values when the internalType is OBJECT or ARRAY. All other cases will return null.

Specified by:
get in interface List<E extends Value>
Overrides:
get in class Value
Parameters:
index - The index to get the value for.
Returns:
Value The Value at the index or null.

indexOf

public int indexOf(Object o)
Specified by:
indexOf in interface List<E extends Value>

isEmpty

public boolean isEmpty()
Specified by:
isEmpty in interface Collection<E extends Value>
Specified by:
isEmpty in interface List<E extends Value>

iterator

public Iterator<E> iterator()
Specified by:
iterator in interface Iterable<E extends Value>
Specified by:
iterator in interface Collection<E extends Value>
Specified by:
iterator in interface List<E extends Value>

lastIndexOf

public int lastIndexOf(Object o)
Specified by:
lastIndexOf in interface List<E extends Value>

listIterator

public ListIterator<E> listIterator()
Specified by:
listIterator in interface List<E extends Value>

listIterator

public ListIterator<E> listIterator(int index)
Specified by:
listIterator in interface List<E extends Value>

remove

public boolean remove(Object o)
Specified by:
remove in interface Collection<E extends Value>
Specified by:
remove in interface List<E extends Value>

remove

public E remove(int index)
Specified by:
remove in interface List<E extends Value>

removeAll

public boolean removeAll(Collection<?> c)
Specified by:
removeAll in interface Collection<E extends Value>
Specified by:
removeAll in interface List<E extends Value>

retainAll

public boolean retainAll(Collection<?> c)
Specified by:
retainAll in interface Collection<E extends Value>
Specified by:
retainAll in interface List<E extends Value>

set

public E set(int index,
             E element)
Specified by:
set in interface List<E extends Value>

size

public int size()
Description copied from class: Value
Retrieves the size of the Value. If string internalType, this will return the length of the String. If this internalType is an Array or an Object then it will return the number of elements in the Object. If this Value is not a String, Array or Object then this will return -1.

Specified by:
size in interface Collection<E extends Value>
Specified by:
size in interface List<E extends Value>
Overrides:
size in class Value
Returns:
size of the Value or -1 if this Value has no size.

subList

public List<E> subList(int fromIndex,
                       int toIndex)
Specified by:
subList in interface List<E extends Value>

toArray

public Object[] toArray()
Specified by:
toArray in interface Collection<E extends Value>
Specified by:
toArray in interface List<E extends Value>

toArray

public <T> T[] toArray(T[] a)
Specified by:
toArray in interface Collection<E extends Value>
Specified by:
toArray in interface List<E extends Value>

nestedSize

public int nestedSize()
Description copied from class: Value
Finds the nested elements under this Value. This is effectively the count of all JSON Values attached to this Value. This number does not include this value itself.

Specified by:
nestedSize in class Value
Returns:
int The count of all Values attached to this Value.

toJSON

public String toJSON()
Description copied from class: Value
Converts the current Value into a JSON String that represents it.

Specified by:
toJSON in class Value
Returns:
The JSON Value as JSON String.


Copyright © 2012. All Rights Reserved.