Class HtmlDocSerializer.Builder<SELF extends HtmlDocSerializer.Builder<SELF>>
- Direct Known Subclasses:
HtmlDocSerializer.DefaultBuilder,HtmlSchemaDocSerializer.Builder
- Enclosing class:
- HtmlDocSerializer
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedBuilder()Constructor, default settings.protectedBuilder(HtmlDocSerializer copyFrom) Copy constructor.protectedBuilder(HtmlDocSerializer.Builder<?> copyFrom) Copy constructor. -
Method Summary
Modifier and TypeMethodDescriptionaside()Returns the list of aside section contents.Aside section contents.asideFloat(AsideFloat value) Float aside section contents.build()Build the object.abstract SELFcopy()Copy creator.footer()Returns the list of footer section contents.Footer section contents.hashKey()Returns the hashkey of this builder.head()Returns the list of head section contents.Additional head section content.header()Returns the list of header section contents.Header section contents.nav()Returns the list of nav section contents.Nav section contents.navlinks()Returns the list of navlinks section contents.Page navigation links.noResultsMessage(String value) No-results message.nowrap()Prevent word wrap on page.nowrap(boolean value) Same asnowrap()but allows you to explicitly specify the boolean value.Resolve $ variables in serialized POJO.resolveBodyVars(boolean value) Same asresolveBodyVars()but allows you to explicitly specify the boolean value.script()Returns the list of page script contents.Adds the specified Javascript code to the HTML page.style()Returns the list of page style contents.Adds the specified CSS instructions to the HTML page.Returns the list of stylesheet URLs.stylesheet(String... value) Adds to the list of stylesheet URLs.template(Class<? extends HtmlDocTemplate> value) HTML document template.List<Class<? extends HtmlWidget>>widgets()Returns the list of page widgets.widgets(Class<? extends HtmlWidget>... values) HTML Widgets.Methods inherited from class org.apache.juneau.marshall.html.HtmlSerializer.Builder
addBeanTypesHtml, addBeanTypesHtml, addKeyValueTableHeaders, addKeyValueTableHeaders, disableDetectLabelParameters, disableDetectLabelParameters, disableDetectLinksInStrings, disableDetectLinksInStrings, labelParameter, uriAnchorTextMethods inherited from class org.apache.juneau.marshall.xml.XmlSerializer.Builder
addBeanTypesXml, addBeanTypesXml, addNamespaceUrisToRoot, addNamespaceUrisToRoot, defaultNamespace, disableAutoDetectNamespaces, disableAutoDetectNamespaces, disableJsonTags, disableJsonTags, enableNamespaces, enableNamespaces, namespaces, ns, textNodeDelimiterMethods inherited from class org.apache.juneau.marshall.serializer.WriterSerializer.Builder
maxIndent, quoteChar, quoteCharOverride, sq, streamCharset, useWhitespace, useWhitespace, wsMethods inherited from class org.apache.juneau.marshall.serializer.Serializer.Builder
accept, addBeanTypes, addBeanTypes, addRootType, addRootType, getAccept, getProduces, keepNullProperties, keepNullProperties, listener, nonDefault, nonDefault, produces, sortCollections, sortCollections, sortMaps, sortMaps, trimEmptyCollections, trimEmptyCollections, trimEmptyMaps, trimEmptyMaps, trimStrings, trimStrings, uriContext, uriRelativity, uriResolutionMethods inherited from class org.apache.juneau.marshall.MarshallingTraverseContext.Builder
detectRecursions, detectRecursions, ignoreRecursions, ignoreRecursions, initialDepth, maxDepthMethods inherited from class org.apache.juneau.marshall.MarshallingContextable.Builder
activeView, annotations, beanClassVisibility, beanConstructorVisibility, beanDictionary, beanFieldVisibility, beanInterceptor, beanMapPutReturnsOldValue, beanMethodVisibility, beanProperties, beanProperties, beanProperties, beanPropertiesExcludes, beanPropertiesExcludes, beanPropertiesExcludes, beanPropertiesReadOnly, beanPropertiesReadOnly, beanPropertiesReadOnly, beanPropertiesWriteOnly, beanPropertiesWriteOnly, beanPropertiesWriteOnly, beansRequireDefaultConstructor, beansRequireSerializable, beansRequireSettersForGetters, bigNumberFormat, binaryFormat, bitSetFormat, booleanFormat, calendarFormat, classFormat, classLoader, currencyFormat, dateFormat, debug, dictionaryOn, disableBeansRequireSomeProperties, disableDefaultViewInclusion, disableIgnoreMissingSetters, disableIgnoreTransientFields, disableIgnoreUnknownNullBeanProperties, disableInterfaceProxies, durationFormat, enumFormat, example, example, findFluentSetters, findFluentSetters, floatFormat, ignoreInvocationExceptionsOnGetters, ignoreInvocationExceptionsOnSetters, ignoreUnknownBeanProperties, ignoreUnknownEnumValues, implClass, implClasses, interfaceClass, interfaces, locale, localeFormat, marshallingContext, marshallingContext, marshallingContext, marshallingContext, mediaType, notBeanClasses, notBeanPackages, periodFormat, propertyNamer, propertyNamer, recordComponentOrder, stopClass, swap, swap, swaps, swaps, temporalFormat, timeZone, timeZoneFormat, typeName, typePropertyName, typePropertyName, unsortedProperties, unsortedProperties, useJavaBeanIntrospector, uuidFormat, validateSchema, validateSchemaMethods inherited from class org.apache.juneau.marshall.Context.Builder
annotations, apply, applyAnnotations, applyAnnotations, asSubtype, build, cache, canApply, copyOrNull, debug, getApplied, getType, impl, isDebug, registerBuilders, self, type
-
Constructor Details
-
Builder
protected Builder()Constructor, default settings. -
Builder
Copy constructor.- Parameters:
copyFrom- The builder to copy from.
-
Builder
Copy constructor.- Parameters:
copyFrom- The bean to copy from.
-
-
Method Details
-
aside
Returns the list of aside section contents.Gives access to the inner list if you need to make more than simple additions via
aside(String...).- Returns:
- The list of aside section contents.
- See Also:
-
aside
Aside section contents.Allows you to specify the contents of the aside section on the HTML page. The aside section floats on the right of the page for providing content supporting the serialized content of the page.
By default, the aside section is empty.
Example:
WriterSerializer
serializer = HtmlDocSerializer .create () .aside("<ul>" ," <li>Item 1" ," <li>Item 2" ," <li>Item 3" ,"</ul>" ) .build();Notes:
- Format: HTML
-
Supports REST Server SVL Variables
(e.g.
"$L{my.localized.variable}" ). -
A value of
"NONE" can be used to force no value. -
The parent value can be included by adding the literal
"INHERIT" as a value. - Multiple values are combined with newlines into a single string.
-
On methods, this value is inherited from the
@HtmlDocConfig annotation on the servlet/resource class. -
On servlet/resource classes, this value is inherited from the
@HtmlDocConfig annotation on the parent class.
- Parameters:
value- The new value for this property.- Returns:
- This object.
-
asideFloat
Float aside section contents.Allows you to position the aside contents of the page around the main contents.
By default, the aside section is floated to the right.
Example:
WriterSerializer
serializer = HtmlDocSerializer .create () .aside("<ul>" ," <li>Item 1" ," <li>Item 2" ," <li>Item 3" ,"</ul>" ) .asideFloat(RIGHT ) .build();- Parameters:
value- The new value for this property.- Returns:
- This object.
-
build
Description copied from class:Context.BuilderBuild the object.- Overrides:
buildin classHtmlStrippedDocSerializer.Builder<SELF extends HtmlDocSerializer.Builder<SELF>>- Returns:
- The built object.
-
copy
Description copied from class:Context.BuilderCopy creator.- Specified by:
copyin classHtmlStrippedDocSerializer.Builder<SELF extends HtmlDocSerializer.Builder<SELF>>- Returns:
- A new mutable copy of this builder.
-
hashKey
Description copied from class:Context.BuilderReturns the hashkey of this builder.Used to return previously instantiated context beans that have matching hashkeys. The
HashKeyobject is suitable for use as a hashmap key of a map of context beans. A context bean is considered equivalent if theHashKey.equals(Object)method is the same.- Overrides:
hashKeyin classHtmlSerializer.Builder<SELF extends HtmlDocSerializer.Builder<SELF>>- Returns:
- The hashkey of this builder.
-
head
Returns the list of head section contents.Gives access to the inner list if you need to make more than simple additions via
head(String...).- Returns:
- The list of head section contents.
- See Also:
-
head
Additional head section content.Adds the specified HTML content to the head section of the page.
Example:
WriterSerializer
serializer = HtmlDocSerializer .create () .head("<link rel='icon' href='$U{servlet:/htdocs/mypageicon.ico}'>" ) .build();- Parameters:
value- The new value for this property.- Returns:
- This object.
-
header
Returns the list of header section contents.Gives access to the inner list if you need to make more than simple additions via
header(String...).- Returns:
- The list of header section contents.
- See Also:
-
header
Header section contents.Allows you to override the contents of the header section on the HTML page. The header section normally contains the title and description at the top of the page.
Example:
WriterSerializer
serializer = HtmlDocSerializer .create () .header("<h1>My own header</h1>" ) .build()- Parameters:
value- The new value for this property.- Returns:
- This object.
-
noResultsMessage
No-results message.Allows you to specify the string message used when trying to serialize an empty array or empty list.
Example:
WriterSerializer
serializer = HtmlDocSerializer .create () .noResultsMessage("<b>This interface is great!</b>" ) .build();A value of
"NONE" can be used to represent no value to differentiate it from an empty string.- Parameters:
value- The new value for this property.- Returns:
- This object.
-
nowrap
Prevent word wrap on page.Adds
"* {white-space:nowrap}" to the CSS instructions on the page to prevent word wrapping.- Returns:
- This object.
-
nowrap
Same asnowrap()but allows you to explicitly specify the boolean value.- Parameters:
value- The new value for this property.- Returns:
- This object.
- See Also:
-
resolveBodyVars
Resolve $ variables in serialized POJO.- Returns:
- This object.
-
resolveBodyVars
Same asresolveBodyVars()but allows you to explicitly specify the boolean value.- Parameters:
value- The new value for this property.- Returns:
- This object.
- See Also:
-
script
Returns the list of page script contents.Gives access to the inner list if you need to make more than simple additions via
script(String...).- Returns:
- The list of page script contents.
- See Also:
-
script
Adds the specified Javascript code to the HTML page.A shortcut on
@Rest is also provided for this setting:WriterSerializer
serializer = HtmlDocSerializer .create () .script("alert('hello!');" ) .build();- Parameters:
value- The value to add to this property.- Returns:
- This object.
-
style
Returns the list of page style contents.Gives access to the inner list if you need to make more than simple additions via
style(String...).- Returns:
- The list of page style contents.
- See Also:
-
style
Adds the specified CSS instructions to the HTML page.WriterSerializer
serializer = HtmlDocSerializer .create () .style("h3 { color: red; }" ,"h5 { font-weight: bold; }" ) .build();- Parameters:
value- The value to add to this property.- Returns:
- This object.
-
stylesheet
Returns the list of stylesheet URLs.Gives access to the inner list if you need to make more than simple additions via
stylesheet(String...).- Returns:
- The list of stylesheet URLs.
- See Also:
-
stylesheet
Adds to the list of stylesheet URLs.Note that this stylesheet is controlled by the
annotation.@Rest .stylesheet()- Parameters:
value- The value to add to this property.- Returns:
- This object.
-
template
HTML document template.Specifies the template to use for serializing the page.
By default, the
BasicHtmlDocTemplateclass is used to construct the contents of the HTML page, but can be overridden with your own custom implementation class.Example:
WriterSerializer
serializer = HtmlDocSerializer .create () .template(MySpecialDocTemplate.class ) .build();- Parameters:
value- The new value for this property.- Returns:
- This object.
-
widgets
Returns the list of page widgets.Gives access to the inner list if you need to make more than simple additions via
widgets(Class...).- Returns:
- The list of page widgets.
- See Also:
-
widgets
HTML Widgets.Defines widgets that can be used in conjunction with string variables of the form
"$W{name}" to quickly generate arbitrary replacement text. Widgets resolve the following variables:"$W{name}" - Contents returned byHtmlWidget.getHtml(VarResolverSession)."$W{name.script}" - Contents returned byHtmlWidget.getScript(VarResolverSession).
The script contents are automatically inserted into the<head/script> section in the HTML page."$W{name.style}" - Contents returned byHtmlWidget.getStyle(VarResolverSession).
The styles contents are automatically inserted into the<head/style> section in the HTML page.
The following examples shows how to associate a widget with a REST method and then have it rendered in the links and aside section of the page:
WriterSerializer
serializer = HtmlDocSerializer .create () .widgets( MyWidget.class ) .navlinks("$W{MyWidget}" ) .aside("Check out this widget: $W{MyWidget}" ) .build();Notes:
- Widgets are inherited from super classes, but can be overridden by reusing the widget name.
See Also:
- Parameters:
values- The values to add to this setting.- Returns:
- This object.
-