Package com.cedarsoftware.util.io
Class JsonObject<K,V>
- java.lang.Object
-
- java.util.AbstractMap<K,V>
-
- java.util.HashMap<K,V>
-
- java.util.LinkedHashMap<K,V>
-
- com.cedarsoftware.util.io.JsonObject<K,V>
-
- Type Parameters:
K
- field name in Map-of-MapV
- Value
- All Implemented Interfaces:
Serializable
,Cloneable
,Map<K,V>
public class JsonObject<K,V> extends LinkedHashMap<K,V>
This class holds a JSON object in a LinkedHashMap. LinkedHashMap used to keep fields in same order as they are when reflecting them in Java. Instances of this class hold a Map-of-Map representation of a Java object, read from the JSON input stream.- Author:
- John DeRegnaucourt ([email protected])
Copyright (c) Cedar Software LLC
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.* - See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class java.util.AbstractMap
AbstractMap.SimpleEntry<K extends Object,V extends Object>, AbstractMap.SimpleImmutableEntry<K extends Object,V extends Object>
-
-
Constructor Summary
Constructors Constructor Description JsonObject()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
clear()
Object[]
getArray()
int
getCol()
Class
getComponentType()
long
getId()
int
getLength()
int
getLine()
Object
getPrimitiveValue()
Long
getReferenceId()
Object
getTarget()
Class
getTargetClass()
String
getType()
boolean
hasId()
boolean
isArray()
boolean
isCollection()
boolean
isLogicalPrimitive()
boolean
isMap()
boolean
isReference()
V
put(K key, V value)
void
setTarget(Object target)
void
setType(String type)
int
size()
String
toString()
-
Methods inherited from class java.util.LinkedHashMap
containsValue, entrySet, forEach, get, getOrDefault, keySet, removeEldestEntry, replaceAll, values
-
Methods inherited from class java.util.HashMap
clone, compute, computeIfAbsent, computeIfPresent, containsKey, isEmpty, merge, putAll, putIfAbsent, remove, remove, replace, replace
-
Methods inherited from class java.util.AbstractMap
equals, hashCode
-
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface java.util.Map
compute, computeIfAbsent, computeIfPresent, containsKey, equals, hashCode, isEmpty, merge, putAll, putIfAbsent, remove, remove, replace, replace
-
-
-
-
Field Detail
-
KEYS
public static final String KEYS
- See Also:
- Constant Field Values
-
ITEMS
public static final String ITEMS
- See Also:
- Constant Field Values
-
ID
public static final String ID
- See Also:
- Constant Field Values
-
REF
public static final String REF
- See Also:
- Constant Field Values
-
TYPE
public static final String TYPE
- See Also:
- Constant Field Values
-
-
Method Detail
-
toString
public String toString()
- Overrides:
toString
in classAbstractMap<K,V>
-
getId
public long getId()
-
hasId
public boolean hasId()
-
setType
public void setType(String type)
-
getType
public String getType()
-
getTarget
public Object getTarget()
-
setTarget
public void setTarget(Object target)
-
getTargetClass
public Class getTargetClass()
-
isLogicalPrimitive
public boolean isLogicalPrimitive()
-
getPrimitiveValue
public Object getPrimitiveValue()
-
isReference
public boolean isReference()
- Returns:
- boolean true if this object references another object, false otherwise.
-
getReferenceId
public Long getReferenceId()
-
isMap
public boolean isMap()
-
isCollection
public boolean isCollection()
-
isArray
public boolean isArray()
-
getArray
public Object[] getArray()
-
getLength
public int getLength()
-
getComponentType
public Class getComponentType()
-
clear
public void clear()
-
getLine
public int getLine()
- Returns:
- int line where this object '{' started in the JSON stream
-
getCol
public int getCol()
- Returns:
- int column where this object '{' started in the JSON stream
-
-