org.less4j
Class JSON.Array

java.lang.Object
  extended by java.util.AbstractCollection
      extended by java.util.AbstractList
          extended by java.util.ArrayList
              extended by org.less4j.JSON.Array
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, java.lang.Iterable, java.util.Collection, java.util.List, java.util.RandomAccess
Enclosing class:
JSON

public static class JSON.Array
extends java.util.ArrayList

An extension of ArrayList with type-casting convenience methods that throw JSON.Error or return a typed object.

Synopsis

...

try {
    JSON.Array list = (new JSON()).array(
        "[true, 1, 3.0, 1234e-2, \"test\", [], {}]"
    );
    Object o = list.get(0); 
    Boolean b = list.B(1);
    BigInteger i = list.I(2);
    BigDecimal d = list.D(3);
    Double r = list.F(4);
    JSON.Array a = list.A(5);
    JSON.Object o = list.O(6);
    Boolean b = list.A(5).B(2);
} catch (JSON.Error e) {
    System.out.println(e.jstr());
}
...

Copyright © 2006 Laurent A.V. Szyster

Version:
0.30
See Also:
Serialized Form

Constructor Summary
JSON.Array()
           
 
Method Summary
 JSON.Array A(int index)
           
 JSON.Array A(int index, JSON.Array def)
           
 java.lang.Boolean B(int index)
           
 boolean B(int index, boolean def)
           
 java.math.BigDecimal D(int index)
           
 java.math.BigDecimal D(int index, java.math.BigDecimal def)
           
 double doubleValue(int index, double def)
           
 java.lang.Double F(int index)
           
 java.math.BigInteger I(int index)
           
 int intValue(int index, int def)
           
 JSON.Object O(int index)
           
 JSON.Object O(int index, JSON.Object def)
           
 java.lang.String S(int index)
           
 java.lang.String S(int index, java.lang.String def)
           
 
Methods inherited from class java.util.ArrayList
add, add, addAll, addAll, clear, clone, contains, ensureCapacity, get, indexOf, isEmpty, lastIndexOf, remove, remove, set, size, toArray, toArray, trimToSize
 
Methods inherited from class java.util.AbstractList
equals, hashCode, iterator, listIterator, listIterator, subList
 
Methods inherited from class java.util.AbstractCollection
containsAll, removeAll, retainAll, toString
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.List
containsAll, equals, hashCode, iterator, listIterator, listIterator, removeAll, retainAll, subList
 

Constructor Detail

JSON.Array

public JSON.Array()
Method Detail

A

public final JSON.Array A(int index)
                   throws JSON.Error
Throws:
JSON.Error

A

public final JSON.Array A(int index,
                          JSON.Array def)

B

public final java.lang.Boolean B(int index)
                          throws JSON.Error
Throws:
JSON.Error

B

public final boolean B(int index,
                       boolean def)

D

public final java.math.BigDecimal D(int index)
                             throws JSON.Error
Throws:
JSON.Error

D

public final java.math.BigDecimal D(int index,
                                    java.math.BigDecimal def)

doubleValue

public final double doubleValue(int index,
                                double def)

F

public final java.lang.Double F(int index)
                         throws JSON.Error
Throws:
JSON.Error

I

public final java.math.BigInteger I(int index)
                             throws JSON.Error
Throws:
JSON.Error

intValue

public final int intValue(int index,
                          int def)

O

public final JSON.Object O(int index)
                    throws JSON.Error
Throws:
JSON.Error

O

public final JSON.Object O(int index,
                           JSON.Object def)

S

public final java.lang.String S(int index)
                         throws JSON.Error
Throws:
JSON.Error

S

public final java.lang.String S(int index,
                                java.lang.String def)