public class MappingGeneratorImpl extends Object implements MappingGenerator
Modifier and Type | Field and Description |
---|---|
private MapperConfig |
config |
private javax.json.stream.JsonGenerator |
generator |
private Boolean |
isDeduplicateObjects |
private Map<Object,String> |
jsonPointers |
private Mappings |
mappings |
Constructor and Description |
---|
MappingGeneratorImpl(MapperConfig config,
javax.json.stream.JsonGenerator jsonGenerator,
Mappings mappings,
Boolean isDeduplicateObjects) |
Modifier and Type | Method and Description |
---|---|
private <T> Object |
doConvertFrom(T value,
Adapter<T,Object> converter) |
private <T> void |
doWriteIterable(Iterable<T> object,
Collection<String> ignoredProperties,
JsonPointerTracker jsonPointer) |
void |
doWriteObject(Object object,
javax.json.stream.JsonGenerator generator,
boolean writeBody,
Collection<String> ignoredProperties,
JsonPointerTracker jsonPointer) |
private void |
doWriteObjectBody(Object object,
Collection<String> ignored,
JsonPointerTracker jsonPointer) |
javax.json.stream.JsonGenerator |
getJsonGenerator() |
private static boolean |
isFloat(Class<?> type) |
private static boolean |
isInt(Class<?> type) |
private void |
writeArray(Class<?> type,
Adapter itemConverter,
String key,
Object arrayValue,
Collection<String> ignoredProperties,
JsonPointerTracker jsonPointer)
Write a JSON Array with a given Array Value, like byte[], int[], Person[] etc.
|
private void |
writeItem(Object o,
Collection<String> ignoredProperties,
JsonPointerTracker jsonPointer) |
private javax.json.stream.JsonGenerator |
writeMapBody(Map<?,?> object,
Adapter itemConverter) |
MappingGenerator |
writeObject(Object object,
javax.json.stream.JsonGenerator generator)
Write the given Object o into the current JSON layer.
|
private boolean |
writePrimitives(Object value) |
private boolean |
writePrimitives(String key,
Class<?> type,
Object value) |
private void |
writeValue(Class<?> type,
boolean dynamic,
boolean primitive,
boolean array,
boolean collection,
boolean map,
Adapter itemConverter,
String key,
Object value,
ObjectConverter.Writer objectConverter,
Collection<String> ignoredProperties,
JsonPointerTracker jsonPointer) |
private final MapperConfig config
private final javax.json.stream.JsonGenerator generator
private final Mappings mappings
private final Boolean isDeduplicateObjects
MappingGeneratorImpl(MapperConfig config, javax.json.stream.JsonGenerator jsonGenerator, Mappings mappings, Boolean isDeduplicateObjects)
public javax.json.stream.JsonGenerator getJsonGenerator()
getJsonGenerator
in interface MappingGenerator
JsonGenerator
used internally to write the JSON output.public MappingGenerator writeObject(Object object, javax.json.stream.JsonGenerator generator)
MappingGenerator
public class Customer { private String firstName; private String lastName; private Address address; ... }then the resulting JSON String will e.g. look like
"firstName":"Karl", "lastName":"SomeName", "address":{"street":"mystreet"}
writeObject
in interface MappingGenerator
object
- the object to writegenerator
- the jsonp generator to usepublic void doWriteObject(Object object, javax.json.stream.JsonGenerator generator, boolean writeBody, Collection<String> ignoredProperties, JsonPointerTracker jsonPointer)
private javax.json.stream.JsonGenerator writeMapBody(Map<?,?> object, Adapter itemConverter) throws InvocationTargetException, IllegalAccessException
private boolean writePrimitives(Object value)
true
if it was a primitive, false
if the value did not get handledprivate static boolean isInt(Class<?> type)
private static boolean isFloat(Class<?> type)
private void doWriteObjectBody(Object object, Collection<String> ignored, JsonPointerTracker jsonPointer) throws IllegalAccessException, InvocationTargetException
private void writeValue(Class<?> type, boolean dynamic, boolean primitive, boolean array, boolean collection, boolean map, Adapter itemConverter, String key, Object value, ObjectConverter.Writer objectConverter, Collection<String> ignoredProperties, JsonPointerTracker jsonPointer) throws InvocationTargetException, IllegalAccessException
private void writeArray(Class<?> type, Adapter itemConverter, String key, Object arrayValue, Collection<String> ignoredProperties, JsonPointerTracker jsonPointer)
key
- either the attribute key or null
if the array should be rendered without keyprivate void writeItem(Object o, Collection<String> ignoredProperties, JsonPointerTracker jsonPointer)
private <T> void doWriteIterable(Iterable<T> object, Collection<String> ignoredProperties, JsonPointerTracker jsonPointer)
Copyright © 2014–2018 The Apache Software Foundation. All rights reserved.