public class HtmlSerializerSession extends XmlSerializerSession
HtmlSerializer
.
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 |
HtmlSerializerSession(HtmlSerializer ctx,
SerializerSessionArgs args)
Create a new session using properties specified in the context.
|
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.
|
String |
getAnchorText(BeanPropertyMeta pMeta,
Object o)
Returns the anchor text to use for the specified URL object.
|
protected HtmlWriter |
getHtmlWriter(SerializerPipe out)
Converts the specified output target object to an
HtmlWriter . |
boolean |
isAddBeanTypeProperties()
Returns the
HtmlSerializer.HTML_addBeanTypeProperties setting value for this session. |
boolean |
isAddKeyValueTableHeaders()
Returns the
HtmlSerializer.HTML_addKeyValueTableHeaders setting value for this session. |
boolean |
isHtmlMode()
Returns
|
boolean |
isUri(ClassMeta<?> cm,
BeanPropertyMeta pMeta,
Object o)
Returns
|
protected org.apache.juneau.html.HtmlSerializerSession.ContentResult |
serializeAnything(HtmlWriter out,
Object o,
ClassMeta<?> eType,
String name,
int xIndent,
BeanPropertyMeta pMeta,
boolean isRoot)
Serialize the specified object to the specified writer.
|
findNsfMappings, getXmlWriter, serializeAnything
isWriterSerializer, serialize
canIgnoreValue, createBeanTypeNameProperty, createPipe, generalize, getBeanTypeName, getExpectedRootType, getInitialDepth, getJavaMethod, getLastLocation, getListener, getListener, getMaxDepth, getMaxIndent, getQuoteChar, getResponseHeaders, getUriResolver, isDetectRecursions, isIgnoreRecursions, isSortCollections, isSortMaps, isTrimEmptyCollections, isTrimEmptyMaps, isTrimNulls, isTrimStrings, isUseWhitespace, onBeanGetterException, onError, pop, push, relativizeUri, resolveUri, serialize, setCurrentClass, setCurrentProperty, sort, sort, toList, toString, trim, willRecurse
_class, checkForWarnings, convertToMemberType, convertToMemberType, convertToType, convertToType, convertToType, getArgsClassMeta, getBeanMeta, getBeanRegistry, getBeanTypePropertyName, getClassMeta, getClassMeta, getClassMetaForObject, getLocale, getMediaType, getStringBuilder, getTimeZone, isBean, isBean, isDebug, isIgnoreUnknownBeanProperties, 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, hasWarnings, toString
protected HtmlSerializerSession(HtmlSerializer 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.public ObjectMap asMap()
Session
asMap
in class XmlSerializerSession
protected final HtmlWriter getHtmlWriter(SerializerPipe out) throws Exception
HtmlWriter
.out
- The output target object.HtmlWriter
.Exception
public boolean isUri(ClassMeta<?> cm, BeanPropertyMeta pMeta, Object o)
cm
- The ClassMeta of the object being serialized.pMeta
- The property metadata of the bean property of the object.
Can be o
- The object.public String getAnchorText(BeanPropertyMeta pMeta, Object o)
pMeta
- The property metadata of the bean property of the object.
Can be o
- The URL object.public final boolean isAddKeyValueTableHeaders()
HtmlSerializer.HTML_addKeyValueTableHeaders
setting value for this session.HtmlSerializer.HTML_addKeyValueTableHeaders
setting value for this session.public final boolean isAddBeanTypeProperties()
HtmlSerializer.HTML_addBeanTypeProperties
setting value for this session.isAddBeanTypeProperties
in class XmlSerializerSession
HtmlSerializer.HTML_addBeanTypeProperties
setting value for this session.public boolean isHtmlMode()
XmlSerializerSession
The difference in behavior is how empty non-void elements are handled. The XML serializer will produce a collapsed tag, whereas the HTML serializer will produce a start and end tag.
isHtmlMode
in class XmlSerializerSession
protected void doSerialize(SerializerPipe out, Object o) throws Exception
SerializerSession
This method should NOT close the context object.
doSerialize
in class XmlSerializerSession
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 org.apache.juneau.html.HtmlSerializerSession.ContentResult serializeAnything(HtmlWriter out, Object o, ClassMeta<?> eType, String name, int xIndent, BeanPropertyMeta pMeta, boolean isRoot) throws Exception
out
- The writer.o
- The object to serialize.eType
- The expected type of the object if this is a bean property.name
- The attribute name of this object if this object was a field in a JSON object (i.e. key of a
Map.Entry
or property name of a bean).xIndent
- The current indentation value.pMeta
- The bean property being serialized, or isRoot
- Exception
- If a problem occurred trying to convert the output.Copyright © 2018 Apache. All rights reserved.