Package org.apache.juneau.serializer
Class WriterSerializerSession
java.lang.Object
org.apache.juneau.ContextSession
org.apache.juneau.BeanSession
org.apache.juneau.BeanTraverseSession
org.apache.juneau.serializer.SerializerSession
org.apache.juneau.serializer.WriterSerializerSession
- Direct Known Subclasses:
CsvSerializerSession
,JsonSerializerSession
,PlainTextSerializerSession
,UonSerializerSession
,XmlSerializerSession
Subclass of
It has 1 abstract method to implement...
SerializerSession
for character-based serializers.
Description
This class is typically the parent class of all character-based serializers.It has 1 abstract method to implement...
Notes:
- This class is not thread safe and is typically discarded after one use.
See Also:
-
Nested Class Summary
-
Field Summary
Fields inherited from class org.apache.juneau.BeanTraverseSession
indent
-
Constructor Summary
ModifierConstructorDescriptionprotected
Constructor. -
Method Summary
Modifier and TypeMethodDescriptioncreate
(WriterSerializer ctx) Creates a new builder for this object.protected SerializerPipe
createPipe
(Object output) Wraps the specified input object into aParserPipe
object so that it can be easily converted into a stream or reader.Returns the file charset defined on this session.protected final int
Maximum indentation.protected char
Quote character.Returns the stream charset defined on this session.protected final boolean
Use whitespace.final boolean
Returnstrue if this serializer subclasses fromWriterSerializer
.protected JsonMap
Returns the properties on this bean as a map for debugging.final String
Convenience method for serializing an object to aString .final String
Shortcut method for serializing an object to a String.Methods inherited from class org.apache.juneau.serializer.SerializerSession
addVarBean, canIgnoreValue, create, createBeanTypeNameProperty, createDefaultVarResolverSession, doSerialize, forEachEntry, forEachEntry, generalize, getBeanTypeName, getExpectedRootType, getJavaMethod, getListener, getListener, getResponseHeaders, getSchema, getUriContext, getUriRelativity, getUriResolution, getUriResolver, getVarResolver, handleThrown, isAddBeanTypes, isAddRootType, isKeepNullProperties, isSortCollections, isSortMaps, isTrimEmptyCollections, isTrimEmptyMaps, isTrimStrings, onBeanGetterException, onError, push2, relativizeUri, resolve, resolveUri, serialize, sort, sort, sort, swap, toList, toString, trim
Methods inherited from class org.apache.juneau.BeanTraverseSession
getInitialDepth, getLastLocation, getMaxDepth, getOptionalType, getOptionalValue, getStack, isDetectRecursions, isIgnoreRecursions, isOptional, isRoot, pop, push, setCurrentClass, setCurrentProperty, willExceedDepth, willRecurse
Methods inherited from class org.apache.juneau.BeanSession
_class, addWarning, convertToMemberType, convertToMemberType, convertToType, convertToType, convertToType, create, getArgsClassMeta, getBeanClassVisibility, getBeanConstructorVisibility, getBeanDictionary, getBeanFieldVisibility, getBeanMeta, getBeanMethodVisibility, getBeanRegistry, getBeanTypePropertyName, getBeanTypePropertyName, getClassMeta, getClassMeta, getClassMetaForObject, getClassMetaForObject, getLocale, getMediaType, getNamePropertyName, getNotBeanClasses, getNotBeanPackagesNames, getNotBeanPackagesPrefixes, getPropertyNamer, getSwaps, getTimeZone, getTimeZoneId, isBean, isBean, isBeanMapPutReturnsOldValue, isBeansRequireDefaultConstructor, isBeansRequireSerializable, isBeansRequireSettersForGetters, isBeansRequireSomeProperties, isFindFluentSetters, isIgnoreInvocationExceptionsOnGetters, isIgnoreInvocationExceptionsOnSetters, isIgnoreMissingSetters, isIgnoreUnknownBeanProperties, isIgnoreUnknownNullBeanProperties, isSortProperties, isUseEnumNames, isUseInterfaceProxies, isUseJavaBeanIntrospector, newBean, newBean, newBeanMap, newBeanMap, newGenericMap, object, string, toArray, toBeanMap, toBeanMap, toBeanMap
Methods inherited from class org.apache.juneau.ContextSession
checkForWarnings, getContext, getSessionProperties, getWarnings, isDebug, toString
-
Constructor Details
-
WriterSerializerSession
Constructor.- Parameters:
builder
- The builder for this object.
-
-
Method Details
-
create
Creates a new builder for this object.- Parameters:
ctx
- The context creating this session.- Returns:
- A new builder.
-
isWriterSerializer
Description copied from class:SerializerSession
Returnstrue if this serializer subclasses fromWriterSerializer
.- Overrides:
isWriterSerializer
in classSerializerSession
- Returns:
true if this serializer subclasses fromWriterSerializer
.
-
createPipe
Description copied from class:SerializerSession
Wraps the specified input object into aParserPipe
object so that it can be easily converted into a stream or reader.- Overrides:
createPipe
in classSerializerSession
- Parameters:
output
- The output location.
For character-based serializers, this can be any of the following types:Writer
OutputStream
- Output will be written as UTF-8 encoded stream.File
- Output will be written as system-default encoded stream.StringBuilder
For byte-based serializers, this can be any of the following types:- Returns:
- A new
ParserPipe
wrapper around the specified input object.
-
serialize
Convenience method for serializing an object to aString .- Overrides:
serialize
in classSerializerSession
- Parameters:
o
- The object to serialize.- Returns:
- The output serialized to a string.
- Throws:
SerializeException
- If a problem occurred trying to convert the output.
-
serializeToString
Description copied from class:SerializerSession
Shortcut method for serializing an object to a String.- Overrides:
serializeToString
in classSerializerSession
- Parameters:
o
- The object to serialize.- Returns:
- The serialized object.
Character-based serializers will return aString
Stream-based serializers will return a
converted to a string based on thebyte []OutputStreamSerializer.Builder.binaryFormat(BinaryFormat)
setting. - Throws:
SerializeException
- If a problem occurred trying to convert the output.
-
getMaxIndent
Maximum indentation.- Returns:
- The maximum indentation level in the serialized document.
- See Also:
-
getQuoteChar
Quote character.- Returns:
- The character used for quoting attributes and values.
- See Also:
-
isUseWhitespace
Use whitespace.- Returns:
- The character used for quoting attributes and values.
- See Also:
-
getFileCharset
Returns the file charset defined on this session.- Returns:
- the file charset defined on this session.
-
getStreamCharset
Returns the stream charset defined on this session.- Returns:
- the stream charset defined on this session.
-
properties
Description copied from class:ContextSession
Returns the properties on this bean as a map for debugging.- Overrides:
properties
in classSerializerSession
- Returns:
- The properties on this bean as a map for debugging.
-