public abstract class WriterSerializerSession extends SerializerSession
SerializerSession
for character-based serializers.
This class is NOT thread safe. It is typically discarded after one-time use although it can be reused within the same thread.
indent
Modifier | Constructor and Description |
---|---|
protected |
WriterSerializerSession(SerializerSessionArgs args)
Constructor for sessions that don't require context.
|
protected |
WriterSerializerSession(WriterSerializer ctx,
SerializerSessionArgs args)
Create a new session using properties specified in the context.
|
Modifier and Type | Method and Description |
---|---|
protected SerializerPipe |
createPipe(Object output)
Wraps the specified input object into a
ParserPipe object so that it can be easily converted into
a stream or reader. |
protected int |
getMaxIndent()
Configuration property: Maximum indentation.
|
protected char |
getQuoteChar()
Configuration property: Quote character.
|
protected boolean |
isUseWhitespace()
Configuration property: Use whitespace.
|
boolean |
isWriterSerializer()
Returns
WriterSerializer . |
String |
serialize(Object o)
Convenience method for serializing an object to a
|
String |
serializeToString(Object o)
Shortcut method for serializing an object to a String.
|
OMap |
toMap()
Returns the properties defined on this bean context as a simple map for debugging purposes.
|
canIgnoreValue, createBeanTypeNameProperty, createDefaultVarResolverSession, doSerialize, generalize, getBeanTypeName, getExpectedRootType, getJavaMethod, getListener, getListener, getResponseHeaders, getUriContext, getUriRelativity, getUriResolution, getUriResolver, getVarResolver, isAddBeanTypes, isAddRootType, isKeepNullProperties, isSortCollections, isSortMaps, isTrimEmptyCollections, isTrimEmptyMaps, isTrimStrings, onBeanGetterException, onError, push2, relativizeUri, resolve, resolveUri, serialize, sort, sort, swap, toList, toString, trim, varSessionObject
getInitialDepth, getLastLocation, getMaxDepth, getOptionalType, getOptionalValue, getStack, isDetectRecursions, isIgnoreRecursions, isOptional, isRoot, pop, push, setCurrentClass, setCurrentProperty, willExceedDepth, willRecurse
_class, addWarning, checkForWarnings, convertToMemberType, convertToMemberType, convertToType, convertToType, convertToType, getArgsClassMeta, getBeanClassVisibility, getBeanConstructorVisibility, getBeanDictionaryClasses, getBeanFieldVisibility, getBeanFilters, getBeanMeta, getBeanMethodVisibility, getBeanRegistry, getBeanTypePropertyName, getBeanTypePropertyName, getClassMeta, getClassMeta, getClassMetaForObject, getClassMetaForObject, getExamples, getImplClasses, getNamePropertyName, getNotBeanClasses, getNotBeanPackagesNames, getNotBeanPackagesPrefixes, getPropertyNamer, getSchema, getStringBuilder, getSwaps, isBean, isBean, isBeanMapPutReturnsOldValue, isBeansRequireDefaultConstructor, isBeansRequireSerializable, isBeansRequireSettersForGetters, isBeansRequireSomeProperties, isFluentSetters, isIgnoreInvocationExceptionsOnGetters, isIgnoreInvocationExceptionsOnSetters, isIgnorePropertiesWithoutSetters, isIgnoreUnknownBeanProperties, isIgnoreUnknownNullBeanProperties, isSortProperties, isUseEnumNames, isUseInterfaceProxies, isUseJavaBeanIntrospector, newBean, newBean, newBeanMap, newBeanMap, object, returnStringBuilder, string, toArray, toBeanMap, toBeanMap
addToCache, addToCache, getClassProperty, getFromCache, getInstanceArrayProperty, getInstanceProperty, getLocale, getMediaType, getProperties, getProperty, getProperty, getProperty, getPropertyKeys, getTimeZone, getTimeZoneId, getWarnings, hasProperty, hasWarnings, isDebug, toString
protected WriterSerializerSession(WriterSerializer ctx, SerializerSessionArgs args)
ctx
- The context creating this session object.
The context contains all the configuration settings for this object.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.protected WriterSerializerSession(SerializerSessionArgs args)
args
- Runtime session arguments.public final boolean isWriterSerializer()
SerializerSession
WriterSerializer
.isWriterSerializer
in class SerializerSession
WriterSerializer
.protected SerializerPipe createPipe(Object output)
SerializerSession
ParserPipe
object so that it can be easily converted into
a stream or reader.createPipe
in class SerializerSession
output
- The output location.
Writer
OutputStream
- Output will be written as UTF-8 encoded stream.
File
- Output will be written as system-default encoded stream.
StringBuilder
ParserPipe
wrapper around the specified input object.public final String serialize(Object o) throws SerializeException
serialize
in class SerializerSession
o
- The object to serialize.SerializeException
- If a problem occurred trying to convert the output.public final String serializeToString(Object o) throws SerializeException
SerializerSession
serializeToString
in class SerializerSession
o
- The object to serialize.byte []
converted to a string based on the OutputStreamSerializer.OSSERIALIZER_binaryFormat
setting.SerializeException
- If a problem occurred trying to convert the output.protected final int getMaxIndent()
WriterSerializer.WSERIALIZER_maxIndent
protected char getQuoteChar()
WriterSerializer.WSERIALIZER_quoteChar
protected final boolean isUseWhitespace()
WriterSerializer.WSERIALIZER_useWhitespace
public OMap toMap()
Session
toMap
in class SerializerSession
Copyright © 2016–2020 The Apache Software Foundation. All rights reserved.