public class UonSerializerSession extends WriterSerializerSession implements HttpPartSerializerSession
UonSerializer
.
This class is NOT thread safe. It is typically discarded after one-time use although it can be reused within the same thread.
indent
Constructor and Description |
---|
UonSerializerSession(UonSerializer ctx,
Boolean encode,
SerializerSessionArgs args) |
Modifier and Type | Method and Description |
---|---|
ObjectMap |
asMap()
Returns the properties defined on this bean context as a simple map for debugging purposes.
|
protected void |
doSerialize(SerializerPipe out,
Object o)
Serializes a POJO to the specified output stream or writer.
|
protected ParamFormat |
getParamFormat()
Configuration property: Format to use for query/form-data/header values.
|
protected UonWriter |
getUonWriter(SerializerPipe out)
Converts the specified output target object to an
UonWriter . |
boolean |
isAddBeanTypeProperties()
Deprecated.
Unused.
|
protected boolean |
isAddBeanTypes()
Configuration property: Add
|
protected boolean |
isEncodeChars()
Configuration property: Encode non-valid URI characters.
|
String |
serialize(HttpPartSchema schema,
Object value)
Same as
HttpPartSerializerSession.serialize(HttpPartType, HttpPartSchema, Object) but defaults to a |
String |
serialize(HttpPartType type,
HttpPartSchema schema,
Object value)
Converts the specified value to a string that can be used as an HTTP header value, query parameter value,
form-data parameter, or URI path variable.
|
protected SerializerWriter |
serializeAnything(UonWriter out,
Object o,
ClassMeta<?> eType,
String attrName,
BeanPropertyMeta pMeta)
Workhorse method.
|
getMaxIndent, getQuoteChar, isWriterSerializer, serialize, serializeToString
canIgnoreValue, createBeanTypeNameProperty, createPipe, generalize, getBeanTypeName, getExpectedRootType, getJavaMethod, getListener, getListener, getResponseHeaders, getUriContext, getUriRelativity, getUriResolution, getUriResolver, isAddRootType, isSortCollections, isSortMaps, isTrimEmptyCollections, isTrimEmptyMaps, isTrimNullProperties, isTrimStrings, isUseWhitespace, onBeanGetterException, onError, relativizeUri, resolveUri, serialize, sort, sort, toList, toString, trim
getInitialDepth, getLastLocation, getMaxDepth, getStack, isDetectRecursions, isIgnoreRecursions, pop, push, setCurrentClass, setCurrentProperty, willRecurse
_class, checkForWarnings, convertToMemberType, convertToMemberType, convertToType, convertToType, convertToType, getArgsClassMeta, getBeanClassVisibility, getBeanConstructorVisibility, getBeanDictionaryClasses, getBeanFieldVisibility, getBeanMeta, getBeanMethodVisibility, getBeanRegistry, getBeanTypePropertyName, getBeanTypePropertyName, getClassMeta, getClassMeta, getClassMetaForObject, getLocale, getMediaType, getPropertyNamer, getSchema, getStringBuilder, getTimeZone, isBean, isBean, isBeanMapPutReturnsOldValue, isBeansRequireDefaultConstructor, isBeansRequireSerializable, isBeansRequireSettersForGetters, isBeansRequireSomeProperties, isDebug, isFluentSetters, isIgnoreInvocationExceptionsOnGetters, isIgnoreInvocationExceptionsOnSetters, isIgnorePropertiesWithoutSetters, isIgnoreUnknownBeanProperties, isIgnoreUnknownNullBeanProperties, isSortProperties, isUseEnumNames, isUseInterfaceProxies, isUseJavaBeanIntrospector, newBean, newBean, newBeanMap, newBeanMap, newInstance, newInstance, newInstanceFromOuter, object, returnStringBuilder, string, toArray, toBeanMap, toBeanMap
addToCache, addToCache, addWarning, getClassProperty, getFromCache, getInstanceArrayProperty, getInstanceProperty, getLogger, getProperties, getProperty, getProperty, getProperty, getPropertyKeys, getWarnings, hasProperty, hasWarnings, toString
public UonSerializerSession(UonSerializer ctx, Boolean encode, SerializerSessionArgs args)
ctx
- The context creating this session object.
The context contains all the configuration settings for this object.encode
- Override the UonSerializer.UON_encoding
setting.args
- Runtime arguments.
These specify session-level information such as locale and URI context.
It also include session-level properties that override the properties defined on the bean and
serializer contexts.public ObjectMap asMap()
Session
asMap
in class WriterSerializerSession
protected final UonWriter getUonWriter(SerializerPipe out) throws Exception
UonWriter
.protected void doSerialize(SerializerPipe out, Object o) throws Exception
SerializerSession
This method should NOT close the context object.
doSerialize
in class SerializerSession
out
- Where to send the output from the serializer.o
- The object to serialize.Exception
- If thrown from underlying stream, or if the input contains a syntax error or is malformed.protected SerializerWriter serializeAnything(UonWriter out, Object o, ClassMeta<?> eType, String attrName, BeanPropertyMeta pMeta) throws Exception
Determines the type of object, and then calls the appropriate type-specific serialization method.
out
- The writer to serialize to.o
- The object being serialized.eType
- The expected type of the object if this is a bean property.attrName
- The bean property name if this is a bean property.
pMeta
- The bean property metadata.Exception
public String serialize(HttpPartType type, HttpPartSchema schema, Object value) throws SerializeException, SchemaValidationException
HttpPartSerializerSession
Returned values should NOT be URL-encoded.
serialize
in interface HttpPartSerializerSession
type
- The category of value being serialized.schema
- Schema information about the part.
value
- The value being serialized.SerializeException
- If a problem occurred while trying to parse the input.SchemaValidationException
- If the output fails schema validation.public String serialize(HttpPartSchema schema, Object value) throws SerializeException, SchemaValidationException
HttpPartSerializerSession
HttpPartSerializerSession.serialize(HttpPartType, HttpPartSchema, Object)
but defaults to a serialize
in interface HttpPartSerializerSession
schema
- Schema information about the part.
value
- The value being serialized.SerializeException
- If a problem occurred while trying to parse the input.SchemaValidationException
- If the output fails schema validation.protected final boolean isEncodeChars()
UonSerializer.UON_encoding
protected final boolean isAddBeanTypes()
isAddBeanTypes
in class SerializerSession
UonSerializer.UON_addBeanTypes
protected final ParamFormat getParamFormat()
UonSerializer.UON_paramFormat
@Deprecated public final boolean isAddBeanTypeProperties()
Copyright © 2018 Apache. All rights reserved.