public class Mapper extends Object
Modifier and Type | Class and Description |
---|---|
private static class |
Mapper.FallbackConverter |
Modifier and Type | Field and Description |
---|---|
private static JohnzonParameterizedType |
ANY_LIST |
protected boolean |
close |
protected ConcurrentMap<Type,Converter<?>> |
converters |
private static Converter<Object> |
FALLBACK_CONVERTER |
protected javax.json.stream.JsonGeneratorFactory |
generatorFactory |
protected Mappings |
mappings |
protected javax.json.JsonReaderFactory |
readerFactory |
protected boolean |
skipEmptyArray |
protected boolean |
skipNull |
protected boolean |
treatByteArrayAsBase64 |
protected int |
version |
Constructor and Description |
---|
Mapper(javax.json.JsonReaderFactory readerFactory,
javax.json.stream.JsonGeneratorFactory generatorFactory,
boolean doClose,
Map<Class<?>,Converter<?>> converters,
int version,
Comparator<String> attributeOrder,
boolean skipNull,
boolean skipEmptyArray,
AccessMode accessMode,
boolean hiddenConstructorSupported,
boolean useConstructors,
boolean treatByteArrayAsBase64) |
Modifier and Type | Method and Description |
---|---|
private Object |
buildArray(Type type,
javax.json.JsonArray jsonArray) |
private Object |
buildArrayWithComponentType(javax.json.JsonArray jsonArray,
Class<?> componentType) |
private Object |
buildObject(Type inType,
javax.json.JsonObject object) |
private Object |
convertTo(Type aClass,
String text) |
private Object[] |
createParameters(Mappings.ClassMapping mapping,
javax.json.JsonObject object) |
private void |
doCloseOrFlush(javax.json.stream.JsonGenerator generator) |
private static <T> String |
doConverFrom(T value,
Converter<T> converter) |
private <T> javax.json.stream.JsonGenerator |
doWriteArray(Collection<T> object,
javax.json.stream.JsonGenerator inGenerator) |
private void |
doWriteHandlingNullObject(Object object,
javax.json.stream.JsonGenerator generator) |
private javax.json.stream.JsonGenerator |
doWriteObject(javax.json.stream.JsonGenerator generator,
Object object) |
private javax.json.stream.JsonGenerator |
doWriteObjectBody(javax.json.stream.JsonGenerator gen,
Object object) |
private <T> Converter<T> |
findConverter(Type aClass) |
private static boolean |
isFloat(Class<?> type) |
private static boolean |
isInt(Class<?> type) |
private <T> T[] |
mapArray(Class<T> clazz,
javax.json.JsonReader reader) |
private <T> Collection<T> |
mapCollection(Mappings.CollectionMapping mapping,
javax.json.JsonArray jsonArray) |
private <T> T |
mapObject(Type clazz,
javax.json.JsonReader reader) |
<T> T[] |
readArray(InputStream stream,
Class<T> clazz) |
<T> T[] |
readArray(Reader stream,
Class<T> clazz) |
<T> Collection<T> |
readCollection(InputStream stream,
ParameterizedType genericType) |
<T> Collection<T> |
readCollection(Reader stream,
ParameterizedType genericType) |
<T> T |
readJohnzonCollection(InputStream stream,
JohnzonCollectionType<T> genericType) |
<T> T |
readJohnzonCollection(Reader stream,
JohnzonCollectionType<T> genericType) |
<T> T |
readObject(InputStream stream,
Type clazz) |
<T> T |
readObject(Reader stream,
Type clazz) |
<T> T |
readObject(String string,
Type clazz) |
private Object |
toObject(javax.json.JsonValue jsonValue,
Type type) |
private Object |
toValue(javax.json.JsonValue jsonValue,
Converter<?> converter,
Type type) |
<T> void |
writeArray(Collection<T> object,
OutputStream stream) |
<T> void |
writeArray(Collection<T> object,
Writer stream) |
<T> void |
writeArray(Object object,
OutputStream stream) |
<T> void |
writeArray(T[] object,
OutputStream stream) |
<T> void |
writeArray(T[] object,
Writer stream) |
private javax.json.stream.JsonGenerator |
writeItem(javax.json.stream.JsonGenerator generator,
Object o) |
<T> void |
writeIterable(Iterable<T> object,
OutputStream stream) |
<T> void |
writeIterable(Iterable<T> object,
Writer stream) |
private javax.json.stream.JsonGenerator |
writeMapBody(Map<?,?> object,
javax.json.stream.JsonGenerator gen) |
void |
writeObject(Object object,
OutputStream stream) |
void |
writeObject(Object object,
Writer stream) |
String |
writeObjectAsString(Object instance) |
private static javax.json.stream.JsonGenerator |
writePrimitives(javax.json.stream.JsonGenerator generator,
Object value) |
private static javax.json.stream.JsonGenerator |
writePrimitives(javax.json.stream.JsonGenerator generator,
String key,
Class<?> type,
Object value) |
private javax.json.stream.JsonGenerator |
writeValue(javax.json.stream.JsonGenerator generator,
Class<?> type,
boolean primitive,
boolean array,
boolean collection,
boolean map,
String key,
Object value) |
private static final JohnzonParameterizedType ANY_LIST
protected final Mappings mappings
protected final javax.json.JsonReaderFactory readerFactory
protected final javax.json.stream.JsonGeneratorFactory generatorFactory
protected final boolean close
protected final ConcurrentMap<Type,Converter<?>> converters
protected final int version
protected final boolean skipNull
protected final boolean skipEmptyArray
protected final boolean treatByteArrayAsBase64
public Mapper(javax.json.JsonReaderFactory readerFactory, javax.json.stream.JsonGeneratorFactory generatorFactory, boolean doClose, Map<Class<?>,Converter<?>> converters, int version, Comparator<String> attributeOrder, boolean skipNull, boolean skipEmptyArray, AccessMode accessMode, boolean hiddenConstructorSupported, boolean useConstructors, boolean treatByteArrayAsBase64)
private static javax.json.stream.JsonGenerator writePrimitives(javax.json.stream.JsonGenerator generator, Object value)
private static javax.json.stream.JsonGenerator writePrimitives(javax.json.stream.JsonGenerator generator, String key, Class<?> type, Object value)
private static boolean isInt(Class<?> type)
private static boolean isFloat(Class<?> type)
public <T> void writeArray(Object object, OutputStream stream)
public <T> void writeArray(T[] object, OutputStream stream)
public <T> void writeArray(T[] object, Writer stream)
public <T> void writeArray(Collection<T> object, OutputStream stream)
public <T> void writeArray(Collection<T> object, Writer stream)
private <T> javax.json.stream.JsonGenerator doWriteArray(Collection<T> object, javax.json.stream.JsonGenerator inGenerator)
private void doCloseOrFlush(javax.json.stream.JsonGenerator generator)
public <T> void writeIterable(Iterable<T> object, OutputStream stream)
public void writeObject(Object object, OutputStream stream)
private void doWriteHandlingNullObject(Object object, javax.json.stream.JsonGenerator generator)
private javax.json.stream.JsonGenerator doWriteObject(javax.json.stream.JsonGenerator generator, Object object)
private javax.json.stream.JsonGenerator doWriteObjectBody(javax.json.stream.JsonGenerator gen, Object object) throws IllegalAccessException, InvocationTargetException
private javax.json.stream.JsonGenerator writeMapBody(Map<?,?> object, javax.json.stream.JsonGenerator gen) throws InvocationTargetException, IllegalAccessException
private javax.json.stream.JsonGenerator writeValue(javax.json.stream.JsonGenerator generator, Class<?> type, boolean primitive, boolean array, boolean collection, boolean map, String key, Object value) throws InvocationTargetException, IllegalAccessException
private javax.json.stream.JsonGenerator writeItem(javax.json.stream.JsonGenerator generator, Object o)
public <T> T readObject(InputStream stream, Type clazz)
private <T> T mapObject(Type clazz, javax.json.JsonReader reader)
public <T> Collection<T> readCollection(InputStream stream, ParameterizedType genericType)
public <T> T readJohnzonCollection(InputStream stream, JohnzonCollectionType<T> genericType)
public <T> T readJohnzonCollection(Reader stream, JohnzonCollectionType<T> genericType)
public <T> Collection<T> readCollection(Reader stream, ParameterizedType genericType)
public <T> T[] readArray(InputStream stream, Class<T> clazz)
private <T> T[] mapArray(Class<T> clazz, javax.json.JsonReader reader)
private Object buildObject(Type inType, javax.json.JsonObject object) throws Exception
Exception
private Object toValue(javax.json.JsonValue jsonValue, Converter<?> converter, Type type) throws Exception
Exception
private Object[] createParameters(Mappings.ClassMapping mapping, javax.json.JsonObject object) throws Exception
Exception
private Object toObject(javax.json.JsonValue jsonValue, Type type) throws Exception
Exception
private Object buildArray(Type type, javax.json.JsonArray jsonArray) throws Exception
Exception
private <T> Collection<T> mapCollection(Mappings.CollectionMapping mapping, javax.json.JsonArray jsonArray) throws Exception
Exception
Copyright © 2014–2015 The Apache Software Foundation. All rights reserved.