org.apache.juneau.html.HtmlSerializerBuilder Maven / Gradle / Ivy
// ***************************************************************************************************************************
// * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file *
// * distributed with this work for additional information regarding copyright ownership. The ASF licenses this file *
// * to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance *
// * with the License. You may obtain a copy of the License at *
// * *
// * http://www.apache.org/licenses/LICENSE-2.0 *
// * *
// * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an *
// * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the *
// * specific language governing permissions and limitations under the License. *
// ***************************************************************************************************************************
package org.apache.juneau.html;
import static org.apache.juneau.html.HtmlSerializer.*;
import java.util.*;
import org.apache.juneau.*;
import org.apache.juneau.http.*;
import org.apache.juneau.serializer.*;
import org.apache.juneau.xml.*;
/**
* Builder class for building instances of HTML serializers.
*/
public class HtmlSerializerBuilder extends XmlSerializerBuilder {
/**
* Constructor, default settings.
*/
public HtmlSerializerBuilder() {
super();
}
/**
* Constructor.
*
* @param propertyStore The initial configuration settings for this builder.
*/
public HtmlSerializerBuilder(PropertyStore propertyStore) {
super(propertyStore);
}
@Override /* CoreObjectBuilder */
public HtmlSerializer build() {
return new HtmlSerializer(propertyStore);
}
//--------------------------------------------------------------------------------
// Properties
//--------------------------------------------------------------------------------
/**
* Configuration property: Anchor text source.
*
*
* - Name:
"HtmlSerializer.uriAnchorText"
* - Data type:
AnchorText
* - Default:
TO_STRING
* - Session-overridable:
true
*
*
*
* When creating anchor tags (e.g. <a href ='...' > text</a>
)
* in HTML, this setting defines what to set the inner text to.
*
*
* See the {@link AnchorText} enum for possible values.
*
*
Notes:
*
* - This is equivalent to calling
property(HTML_uriAnchorText , value)
.
*
*
* @param value The new value for this property.
* @return This object (for method chaining).
* @see HtmlSerializer#HTML_uriAnchorText
*/
public HtmlSerializerBuilder uriAnchorText(AnchorText value) {
return property(HTML_uriAnchorText, value);
}
/**
* Configuration property: Look for URLs in {@link String Strings}.
*
*
* - Name:
"HtmlSerializer.detectLinksInStrings"
* - Data type:
Boolean
* - Default:
true
* - Session-overridable:
true
*
*
*
* If a string looks like a URL (e.g. starts with "http://" or "https://" , then treat it like a URL
* and make it into a hyperlink based on the rules specified by {@link HtmlSerializer#HTML_uriAnchorText}.
*
*
Notes:
*
* - This is equivalent to calling
property(HTML_detectLinksInStrings , value)
.
* - This introduces a slight performance penalty.
*
*
* @param value The new value for this property.
* @return This object (for method chaining).
* @see HtmlSerializer#HTML_detectLinksInStrings
*/
public HtmlSerializerBuilder detectLinksInStrings(boolean value) {
return property(HTML_detectLinksInStrings, value);
}
/**
* Configuration property: Look for link labels in the "label" parameter of the URL.
*
*
* - Name:
"HtmlSerializer.lookForLabelParameters"
* - Data type:
Boolean
* - Default:
true
* - Session-overridable:
true
*
*
*
* If the URL has a label parameter (e.g. "?label=foobar" ), then use that as the anchor text of the link.
*
*
* The parameter name can be changed via the {@link HtmlSerializer#HTML_labelParameter} property.
*
*
Notes:
*
* - This is equivalent to calling
property(HTML_lookForLabelParameters , value)
.
* - This introduces a slight performance penalty.
*
*
* @param value The new value for this property.
* @return This object (for method chaining).
* @see HtmlSerializer#HTML_lookForLabelParameters
*/
public HtmlSerializerBuilder lookForLabelParameters(boolean value) {
return property(HTML_lookForLabelParameters, value);
}
/**
* Configuration property: The parameter name to use when using {@link HtmlSerializer#HTML_lookForLabelParameters}.
*
*
* - Name:
"HtmlSerializer.labelParameter"
* - Data type:
String
* - Default:
"label"
* - Session-overridable:
true
*
*
* Notes:
*
* - This is equivalent to calling
property(HTML_labelParameter , value)
.
* - This introduces a slight performance penalty.
*
*
* @param value The new value for this property.
* @return This object (for method chaining).
* @see HtmlSerializer#HTML_labelParameter
*/
public HtmlSerializerBuilder labelParameter(String value) {
return property(HTML_labelParameter, value);
}
/**
* Configuration property: Add key/value headers on bean/map tables.
*
*
* - Name:
"HtmlSerializer.addKeyValueTableHeaders"
* - Data type:
Boolean
* - Default:
false
* - Session-overridable:
true
*
*
* Notes:
*
* - This is equivalent to calling
property(HTML_addKeyValueTableHeaders , value)
.
* - This introduces a slight performance penalty.
*
*
* @param value The new value for this property.
* @return This object (for method chaining).
* @see HtmlSerializer#HTML_addKeyValueTableHeaders
*/
public HtmlSerializerBuilder addKeyValueTableHeaders(boolean value) {
return property(HTML_addKeyValueTableHeaders, value);
}
@Override /* XmlSerializerBuilder */
public HtmlSerializerBuilder enableNamespaces(boolean value) {
super.enableNamespaces(value);
return this;
}
@Override /* XmlSerializerBuilder */
public HtmlSerializerBuilder autoDetectNamespaces(boolean value) {
super.autoDetectNamespaces(value);
return this;
}
@Override /* XmlSerializerBuilder */
public HtmlSerializerBuilder addNamespaceUrisToRoot(boolean value) {
super.addNamespaceUrisToRoot(value);
return this;
}
@Override /* XmlSerializerBuilder */
public HtmlSerializerBuilder defaultNamespace(String value) {
super.defaultNamespace(value);
return this;
}
@Override /* XmlSerializerBuilder */
public HtmlSerializerBuilder xsNamespace(Namespace value) {
super.xsNamespace(value);
return this;
}
@Override /* XmlSerializerBuilder */
public HtmlSerializerBuilder namespaces(Namespace...values) {
super.namespaces(values);
return this;
}
@Override /* SerializerBuilder */
public HtmlSerializerBuilder maxDepth(int value) {
super.maxDepth(value);
return this;
}
@Override /* SerializerBuilder */
public HtmlSerializerBuilder initialDepth(int value) {
super.initialDepth(value);
return this;
}
@Override /* SerializerBuilder */
public HtmlSerializerBuilder detectRecursions(boolean value) {
super.detectRecursions(value);
return this;
}
@Override /* SerializerBuilder */
public HtmlSerializerBuilder ignoreRecursions(boolean value) {
super.ignoreRecursions(value);
return this;
}
@Override /* SerializerBuilder */
public HtmlSerializerBuilder useWhitespace(boolean value) {
super.useWhitespace(value);
return this;
}
@Override /* SerializerBuilder */
public HtmlSerializerBuilder ws() {
super.ws();
return this;
}
@Override /* SerializerBuilder */
public HtmlSerializerBuilder addBeanTypeProperties(boolean value) {
super.addBeanTypeProperties(value);
return this;
}
@Override /* SerializerBuilder */
public HtmlSerializerBuilder quoteChar(char value) {
super.quoteChar(value);
return this;
}
@Override /* SerializerBuilder */
public HtmlSerializerBuilder sq() {
super.sq();
return this;
}
@Override /* SerializerBuilder */
public HtmlSerializerBuilder trimNullProperties(boolean value) {
super.trimNullProperties(value);
return this;
}
@Override /* SerializerBuilder */
public HtmlSerializerBuilder trimEmptyCollections(boolean value) {
super.trimEmptyCollections(value);
return this;
}
@Override /* SerializerBuilder */
public HtmlSerializerBuilder trimEmptyMaps(boolean value) {
super.trimEmptyMaps(value);
return this;
}
@Override /* SerializerBuilder */
public HtmlSerializerBuilder trimStrings(boolean value) {
super.trimStrings(value);
return this;
}
@Override /* SerializerBuilder */
public HtmlSerializerBuilder uriContext(UriContext value) {
super.uriContext(value);
return this;
}
@Override /* SerializerBuilder */
public HtmlSerializerBuilder uriResolution(UriResolution value) {
super.uriResolution(value);
return this;
}
@Override /* SerializerBuilder */
public HtmlSerializerBuilder uriRelativity(UriRelativity value) {
super.uriRelativity(value);
return this;
}
@Override /* SerializerBuilder */
public HtmlSerializerBuilder sortCollections(boolean value) {
super.sortCollections(value);
return this;
}
@Override /* SerializerBuilder */
public HtmlSerializerBuilder abridged(boolean value) {
super.abridged(value);
return this;
}
@Override /* SerializerBuilder */
public HtmlSerializerBuilder listener(Class extends SerializerListener> value) {
super.listener(value);
return this;
}
@Override /* SerializerBuilder */
public HtmlSerializerBuilder sortMaps(boolean value) {
super.sortMaps(value);
return this;
}
@Override /* CoreObjectBuilder */
public HtmlSerializerBuilder beansRequireDefaultConstructor(boolean value) {
super.beansRequireDefaultConstructor(value);
return this;
}
@Override /* CoreObjectBuilder */
public HtmlSerializerBuilder beansRequireSerializable(boolean value) {
super.beansRequireSerializable(value);
return this;
}
@Override /* CoreObjectBuilder */
public HtmlSerializerBuilder beansRequireSettersForGetters(boolean value) {
super.beansRequireSettersForGetters(value);
return this;
}
@Override /* CoreObjectBuilder */
public HtmlSerializerBuilder beansRequireSomeProperties(boolean value) {
super.beansRequireSomeProperties(value);
return this;
}
@Override /* CoreObjectBuilder */
public HtmlSerializerBuilder beanMapPutReturnsOldValue(boolean value) {
super.beanMapPutReturnsOldValue(value);
return this;
}
@Override /* CoreObjectBuilder */
public HtmlSerializerBuilder beanConstructorVisibility(Visibility value) {
super.beanConstructorVisibility(value);
return this;
}
@Override /* CoreObjectBuilder */
public HtmlSerializerBuilder beanClassVisibility(Visibility value) {
super.beanClassVisibility(value);
return this;
}
@Override /* CoreObjectBuilder */
public HtmlSerializerBuilder beanFieldVisibility(Visibility value) {
super.beanFieldVisibility(value);
return this;
}
@Override /* CoreObjectBuilder */
public HtmlSerializerBuilder methodVisibility(Visibility value) {
super.methodVisibility(value);
return this;
}
@Override /* CoreObjectBuilder */
public HtmlSerializerBuilder useJavaBeanIntrospector(boolean value) {
super.useJavaBeanIntrospector(value);
return this;
}
@Override /* CoreObjectBuilder */
public HtmlSerializerBuilder useInterfaceProxies(boolean value) {
super.useInterfaceProxies(value);
return this;
}
@Override /* CoreObjectBuilder */
public HtmlSerializerBuilder ignoreUnknownBeanProperties(boolean value) {
super.ignoreUnknownBeanProperties(value);
return this;
}
@Override /* CoreObjectBuilder */
public HtmlSerializerBuilder ignoreUnknownNullBeanProperties(boolean value) {
super.ignoreUnknownNullBeanProperties(value);
return this;
}
@Override /* CoreObjectBuilder */
public HtmlSerializerBuilder ignorePropertiesWithoutSetters(boolean value) {
super.ignorePropertiesWithoutSetters(value);
return this;
}
@Override /* CoreObjectBuilder */
public HtmlSerializerBuilder ignoreInvocationExceptionsOnGetters(boolean value) {
super.ignoreInvocationExceptionsOnGetters(value);
return this;
}
@Override /* CoreObjectBuilder */
public HtmlSerializerBuilder ignoreInvocationExceptionsOnSetters(boolean value) {
super.ignoreInvocationExceptionsOnSetters(value);
return this;
}
@Override /* CoreObjectBuilder */
public HtmlSerializerBuilder sortProperties(boolean value) {
super.sortProperties(value);
return this;
}
@Override /* CoreObjectBuilder */
public HtmlSerializerBuilder notBeanPackages(String...values) {
super.notBeanPackages(values);
return this;
}
@Override /* CoreObjectBuilder */
public HtmlSerializerBuilder notBeanPackages(Collection values) {
super.notBeanPackages(values);
return this;
}
@Override /* CoreObjectBuilder */
public HtmlSerializerBuilder setNotBeanPackages(String...values) {
super.setNotBeanPackages(values);
return this;
}
@Override /* CoreObjectBuilder */
public HtmlSerializerBuilder setNotBeanPackages(Collection values) {
super.setNotBeanPackages(values);
return this;
}
@Override /* CoreObjectBuilder */
public HtmlSerializerBuilder removeNotBeanPackages(String...values) {
super.removeNotBeanPackages(values);
return this;
}
@Override /* CoreObjectBuilder */
public HtmlSerializerBuilder removeNotBeanPackages(Collection values) {
super.removeNotBeanPackages(values);
return this;
}
@Override /* CoreObjectBuilder */
public HtmlSerializerBuilder notBeanClasses(Class>...values) {
super.notBeanClasses(values);
return this;
}
@Override /* CoreObjectBuilder */
public HtmlSerializerBuilder notBeanClasses(Collection> values) {
super.notBeanClasses(values);
return this;
}
@Override /* CoreObjectBuilder */
public HtmlSerializerBuilder setNotBeanClasses(Class>...values) {
super.setNotBeanClasses(values);
return this;
}
@Override /* CoreObjectBuilder */
public HtmlSerializerBuilder setNotBeanClasses(Collection> values) {
super.setNotBeanClasses(values);
return this;
}
@Override /* CoreObjectBuilder */
public HtmlSerializerBuilder removeNotBeanClasses(Class>...values) {
super.removeNotBeanClasses(values);
return this;
}
@Override /* CoreObjectBuilder */
public HtmlSerializerBuilder removeNotBeanClasses(Collection> values) {
super.removeNotBeanClasses(values);
return this;
}
@Override /* CoreObjectBuilder */
public HtmlSerializerBuilder beanFilters(Class>...values) {
super.beanFilters(values);
return this;
}
@Override /* CoreObjectBuilder */
public HtmlSerializerBuilder beanFilters(Collection> values) {
super.beanFilters(values);
return this;
}
@Override /* CoreObjectBuilder */
public HtmlSerializerBuilder setBeanFilters(Class>...values) {
super.setBeanFilters(values);
return this;
}
@Override /* CoreObjectBuilder */
public HtmlSerializerBuilder setBeanFilters(Collection> values) {
super.setBeanFilters(values);
return this;
}
@Override /* CoreObjectBuilder */
public HtmlSerializerBuilder removeBeanFilters(Class>...values) {
super.removeBeanFilters(values);
return this;
}
@Override /* CoreObjectBuilder */
public HtmlSerializerBuilder removeBeanFilters(Collection> values) {
super.removeBeanFilters(values);
return this;
}
@Override /* CoreObjectBuilder */
public HtmlSerializerBuilder pojoSwaps(Class>...values) {
super.pojoSwaps(values);
return this;
}
@Override /* CoreObjectBuilder */
public HtmlSerializerBuilder pojoSwaps(Collection> values) {
super.pojoSwaps(values);
return this;
}
@Override /* CoreObjectBuilder */
public HtmlSerializerBuilder setPojoSwaps(Class>...values) {
super.setPojoSwaps(values);
return this;
}
@Override /* CoreObjectBuilder */
public HtmlSerializerBuilder setPojoSwaps(Collection> values) {
super.setPojoSwaps(values);
return this;
}
@Override /* CoreObjectBuilder */
public HtmlSerializerBuilder removePojoSwaps(Class>...values) {
super.removePojoSwaps(values);
return this;
}
@Override /* CoreObjectBuilder */
public HtmlSerializerBuilder removePojoSwaps(Collection> values) {
super.removePojoSwaps(values);
return this;
}
@Override /* CoreObjectBuilder */
public HtmlSerializerBuilder implClasses(Map,Class>> values) {
super.implClasses(values);
return this;
}
@Override /* CoreObjectBuilder */
public HtmlSerializerBuilder implClass(Class interfaceClass, Class extends T> implClass) {
super.implClass(interfaceClass, implClass);
return this;
}
@Override /* CoreObjectBuilder */
public HtmlSerializerBuilder includeProperties(Map values) {
super.includeProperties(values);
return this;
}
@Override /* CoreObjectBuilder */
public HtmlSerializerBuilder includeProperties(String beanClassName, String properties) {
super.includeProperties(beanClassName, properties);
return this;
}
@Override /* CoreObjectBuilder */
public HtmlSerializerBuilder includeProperties(Class> beanClass, String properties) {
super.includeProperties(beanClass, properties);
return this;
}
@Override /* CoreObjectBuilder */
public HtmlSerializerBuilder excludeProperties(Map values) {
super.excludeProperties(values);
return this;
}
@Override /* CoreObjectBuilder */
public HtmlSerializerBuilder excludeProperties(String beanClassName, String properties) {
super.excludeProperties(beanClassName, properties);
return this;
}
@Override /* CoreObjectBuilder */
public HtmlSerializerBuilder excludeProperties(Class> beanClass, String properties) {
super.excludeProperties(beanClass, properties);
return this;
}
@Override /* CoreObjectBuilder */
public HtmlSerializerBuilder beanDictionary(Class>...values) {
super.beanDictionary(values);
return this;
}
@Override /* CoreObjectBuilder */
public HtmlSerializerBuilder beanDictionary(Collection> values) {
super.beanDictionary(values);
return this;
}
@Override /* CoreObjectBuilder */
public HtmlSerializerBuilder setBeanDictionary(Class>...values) {
super.setBeanDictionary(values);
return this;
}
@Override /* CoreObjectBuilder */
public HtmlSerializerBuilder setBeanDictionary(Collection> values) {
super.setBeanDictionary(values);
return this;
}
@Override /* CoreObjectBuilder */
public HtmlSerializerBuilder removeFromBeanDictionary(Class>...values) {
super.removeFromBeanDictionary(values);
return this;
}
@Override /* CoreObjectBuilder */
public HtmlSerializerBuilder removeFromBeanDictionary(Collection> values) {
super.removeFromBeanDictionary(values);
return this;
}
@Override /* CoreObjectBuilder */
public HtmlSerializerBuilder beanTypePropertyName(String value) {
super.beanTypePropertyName(value);
return this;
}
@Override /* CoreObjectBuilder */
public HtmlSerializerBuilder defaultParser(Class> value) {
super.defaultParser(value);
return this;
}
@Override /* CoreObjectBuilder */
public HtmlSerializerBuilder locale(Locale value) {
super.locale(value);
return this;
}
@Override /* CoreObjectBuilder */
public HtmlSerializerBuilder timeZone(TimeZone value) {
super.timeZone(value);
return this;
}
@Override /* CoreObjectBuilder */
public HtmlSerializerBuilder mediaType(MediaType value) {
super.mediaType(value);
return this;
}
@Override /* CoreObjectBuilder */
public HtmlSerializerBuilder debug() {
super.debug();
return this;
}
@Override /* CoreObjectBuilder */
public HtmlSerializerBuilder property(String name, Object value) {
super.property(name, value);
return this;
}
@Override /* CoreObjectBuilder */
public HtmlSerializerBuilder properties(Map properties) {
super.properties(properties);
return this;
}
@Override /* CoreObjectBuilder */
public HtmlSerializerBuilder addToProperty(String name, Object value) {
super.addToProperty(name, value);
return this;
}
@Override /* CoreObjectBuilder */
public HtmlSerializerBuilder putToProperty(String name, Object key, Object value) {
super.putToProperty(name, key, value);
return this;
}
@Override /* CoreObjectBuilder */
public HtmlSerializerBuilder putToProperty(String name, Object value) {
super.putToProperty(name, value);
return this;
}
@Override /* CoreObjectBuilder */
public HtmlSerializerBuilder removeFromProperty(String name, Object value) {
super.removeFromProperty(name, value);
return this;
}
@Override /* CoreObjectBuilder */
public HtmlSerializerBuilder classLoader(ClassLoader classLoader) {
super.classLoader(classLoader);
return this;
}
@Override /* CoreObjectBuilder */
public HtmlSerializerBuilder apply(PropertyStore copyFrom) {
super.apply(copyFrom);
return this;
}
}