public abstract class Resolver extends Object implements ReaderContext
Modifier and Type | Class and Description |
---|---|
protected static class |
Resolver.Missingfields
stores missing fields information to notify client after the complete deserialization resolution
|
Modifier and Type | Field and Description |
---|---|
protected Collection<Resolver.Missingfields> |
missingFields |
Modifier | Constructor and Description |
---|---|
protected |
Resolver(ReadOptions readOptions,
ReferenceTracker references,
com.cedarsoftware.util.convert.Converter converter) |
Modifier and Type | Method and Description |
---|---|
protected void |
cleanup() |
protected Class<?> |
coerceClassIfNeeded(Class<?> type) |
protected <T> T |
convertJsonValuesToJava(JsonObject root)
Walk a JsonObject (Map of String keys to values) and return the
Java object equivalent filled in as best as possible (everything
except unresolved reference fields or unresolved array/collection elements).
|
protected static void |
convertMapToKeysItems(JsonObject jObj)
Convert an input JsonObject map (known to represent a Map.class or derivative) that has regular keys and values
to have its keys placed into @keys, and its values placed into @items.
|
protected Object |
createInstance(JsonObject jsonObj)
This method creates a Java Object instance based on the passed in parameters.
|
protected Object |
createInstanceUsingType(JsonObject jsonObj)
Create an instance of a Java class using the ".type" field on the jsonObj.
|
protected EnumSet<?> |
extractEnumSet(Class c,
JsonObject jsonObj) |
protected void |
patchUnresolvedReferences()
For all fields where the value was "@ref":"n" where 'n' was the id of an object
that had not yet been encountered in the stream, make the final substitution.
|
protected abstract Object |
readWithFactoryIfExists(Object o,
Class compType,
Deque<JsonObject> stack) |
<T> T |
reentrantConvertJsonValueToJava(JsonObject rootObj,
Class<T> root)
This method converts a rootObj Map, (which contains nested Maps
and so forth representing a Java Object graph), to a Java
object instance.
|
protected void |
rehashMaps()
Process Maps/Sets (fix up their internal indexing structure)
This is required because Maps hash items using hashCode(), which will
change between VMs.
|
protected JsonObject |
resolveRefs(JsonObject jsonObject) |
protected abstract void |
traverseArray(Deque<JsonObject> stack,
JsonObject jsonObj) |
protected abstract void |
traverseCollection(Deque<JsonObject> stack,
JsonObject jsonObj) |
protected void |
traverseMap(Deque<JsonObject> stack,
JsonObject jsonObj)
Process java.util.Map and it's derivatives.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getConverter, getReadOptions, getReferences, traverseFields
protected final Collection<Resolver.Missingfields> missingFields
protected Resolver(ReadOptions readOptions, ReferenceTracker references, com.cedarsoftware.util.convert.Converter converter)
public <T> T reentrantConvertJsonValueToJava(JsonObject rootObj, Class<T> root)
reentrantConvertJsonValueToJava
in interface ReaderContext
rootObj
- JsonObject instance that was the rootObj object from theroot
- When you know the type you will be returning. Can be null (effectively Map.class)
JSON input that was parsed in an earlier call to JsonReader.protected <T> T convertJsonValuesToJava(JsonObject root)
root
- JsonObject reference to a Map-of-Maps representation of the JSON
input after it has been completely read.protected abstract Object readWithFactoryIfExists(Object o, Class compType, Deque<JsonObject> stack)
protected abstract void traverseCollection(Deque<JsonObject> stack, JsonObject jsonObj)
protected abstract void traverseArray(Deque<JsonObject> stack, JsonObject jsonObj)
protected void cleanup()
protected void traverseMap(Deque<JsonObject> stack, JsonObject jsonObj)
stack
- a Stack (Deque) used to support graph traversal.jsonObj
- a Map-of-Map representation of the JSON input stream.protected static void convertMapToKeysItems(JsonObject jObj)
jObj
- Map to convertprotected Object createInstance(JsonObject jsonObj)
jsonObj
- Map-of-Map representation of object to create.protected Object createInstanceUsingType(JsonObject jsonObj)
protected EnumSet<?> extractEnumSet(Class c, JsonObject jsonObj)
protected void patchUnresolvedReferences()
protected void rehashMaps()
protected JsonObject resolveRefs(JsonObject jsonObject)
Copyright © 2024. All rights reserved.