Permalink
Browse files

Integrate JsonObject & JsonArray with java.util properly

  • Loading branch information...
1 parent 6ea938f commit 1493089153c187ff8082c90198583b834e0566bb @ropalka ropalka committed Sep 14, 2012
@@ -19,86 +19,73 @@
*/
package org.fossnova.json;
-import java.util.Iterator;
-import java.util.ListIterator;
+import java.util.List;
/**
* @author <a href="mailto:opalka dot richard at gmail dot com">Richard Opalka</a>
*/
-public interface JsonArray extends JsonStructure {
-
- int size();
-
- boolean isEmpty();
-
- boolean contains( final String value );
-
- boolean contains( final Number value );
-
- boolean contains( final Boolean value );
-
- boolean contains( final JsonStructure value );
-
- Iterator< JsonValue > iterator();
-
- JsonValue[] toArray();
+public interface JsonArray extends JsonStructure, List< JsonValue > {
boolean add( final String value );
boolean add( final Number value );
boolean add( final Boolean value );
- boolean add( final JsonStructure value );
+ boolean add( final JsonValue value );
- boolean remove( final String value );
+ void add( final int index, final String value );
- boolean remove( final Number value );
+ void add( final int index, final Number value );
- boolean remove( final Boolean value );
+ void add( final int index, final Boolean value );
- boolean remove( final JsonStructure value );
+ void add( final int index, final JsonValue value );
- void clear();
+ boolean contains( final String value );
- JsonValue get( final int index );
+ boolean contains( final Number value );
- JsonValue set( final int index, final String value );
+ boolean contains( final Boolean value );
- JsonValue set( final int index, final Number value );
+ boolean contains( final JsonValue value );
+
+ boolean contains( final Object value );
+
+ int indexOf( final String value );
- JsonValue set( final int index, final Boolean value );
+ int indexOf( final Number value );
- JsonValue set( final int index, final JsonStructure value );
+ int indexOf( final Boolean value );
- void add( final int index, final String value );
+ int indexOf( final JsonValue value );
- void add( final int index, final Number value );
+ int lastIndexOf( final String value );
- void add( final int index, final Boolean value );
+ int lastIndexOf( final Number value );
- void add( final int index, final JsonStructure value );
+ int lastIndexOf( final Boolean value );
- JsonValue remove( final int index );
+ int lastIndexOf( final JsonValue value );
- int indexOf( final String value );
+ boolean remove( final String value );
- int indexOf( final Number value );
+ boolean remove( final Number value );
- int indexOf( final Boolean value );
+ boolean remove( final Boolean value );
- int indexOf( final JsonStructure value );
+ boolean remove( final JsonValue value );
- int lastIndexOf( final String value );
+ JsonValue set( final int index, final String value );
- int lastIndexOf( final Number value );
+ JsonValue set( final int index, final Number value );
- int lastIndexOf( final Boolean value );
+ JsonValue set( final int index, final Boolean value );
- int lastIndexOf( final JsonStructure value );
+ JsonValue set( final int index, final JsonValue value );
- ListIterator< JsonValue > listIterator();
+ public JsonArray subList( final int fromIndex, final int toIndex );
- ListIterator< JsonValue > listIterator( int index );
+ JsonValue[] toArray();
}
@@ -19,22 +19,12 @@
*/
package org.fossnova.json;
-import java.util.Collection;
-import java.util.Map.Entry;
-import java.util.Set;
+import java.util.Map;
/**
* @author <a href="mailto:opalka dot richard at gmail dot com">Richard Opalka</a>
*/
-public interface JsonObject extends JsonStructure {
-
- JsonValue put( final String key, final String value );
-
- JsonValue put( final String key, final Boolean value );
-
- JsonValue put( final String key, final Number value );
-
- JsonValue put( final String key, final JsonStructure value );
+public interface JsonObject extends JsonStructure, Map< String, JsonValue > {
boolean containsKey( final String key );
@@ -44,22 +34,16 @@
boolean containsValue( final Number value );
- boolean containsValue( final JsonStructure value );
-
- Collection< JsonValue > values();
-
- Set< Entry< String, JsonValue >> entrySet();
-
- Set< String > keySet();
+ boolean containsValue( final JsonValue value );
JsonValue get( final String key );
- JsonValue remove( final String key );
+ JsonValue put( final String key, final String value );
- void clear();
+ JsonValue put( final String key, final Boolean value );
- int size();
+ JsonValue put( final String key, final Number value );
- boolean isEmpty();
+ JsonValue remove( final String key );
}
Oops, something went wrong.

0 comments on commit 1493089

Please sign in to comment.