public class RdfSerializerBuilder extends WriterSerializerBuilder
Type | Property and Description |
---|---|
RdfSerializerBuilder |
addRoot
|
Constructor and Description |
---|
RdfSerializerBuilder()
Constructor, default settings.
|
RdfSerializerBuilder(PropertyStore ps)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
RdfSerializerBuilder |
add(Map<String,Object> properties)
Adds multiple free-form configuration properties on this object without first clearing out any previous values.
|
RdfSerializerBuilder |
addBeanTypes()
|
RdfSerializerBuilder |
addLiteralTypes()
|
RdfSerializerBuilder |
addLiteralTypes(boolean value)
|
RdfSerializerBuilder |
addRootProperty()
|
RdfSerializerBuilder |
addRootProperty(boolean value)
|
RdfSerializerBuilder |
addRootType()
|
RdfSerializerBuilder |
addTo(String name,
Object value)
Adds a free-form value to a SET property.
|
RdfSerializerBuilder |
annotations(Annotation... values)
|
RdfSerializerBuilder |
appendTo(String name,
Object value)
Adds a free-form value to the end of a LIST property.
|
RdfSerializerBuilder |
apply(PropertyStore copyFrom)
Copies the settings from the specified property store into this builder.
|
RdfSerializerBuilder |
applyAnnotations(AnnotationList al,
VarResolverSession r)
Applies a set of annotations to this property store.
|
RdfSerializerBuilder |
applyAnnotations(Class<?>... fromClasses)
Applies any of the various
|
RdfSerializerBuilder |
applyAnnotations(Method... fromMethods)
Applies any of the various
|
RdfSerializerBuilder |
arp_embedding(boolean value)
|
RdfSerializerBuilder |
arp_errorMode(String value)
|
RdfSerializerBuilder |
arp_iriRules(String value)
|
RdfSerializerBuilder |
autoDetectNamespaces(boolean value)
|
RdfSerializerBuilder |
beanClassVisibility(Visibility value)
|
RdfSerializerBuilder |
beanConstructorVisibility(Visibility value)
|
RdfSerializerBuilder |
beanFieldVisibility(Visibility value)
|
RdfSerializerBuilder |
beanInterceptor(Class<?> on,
Class<? extends BeanInterceptor<?>> value)
Bean interceptor.
|
RdfSerializerBuilder |
beanMapPutReturnsOldValue()
|
RdfSerializerBuilder |
beanMethodVisibility(Visibility value)
|
RdfSerializerBuilder |
beansDontRequireSomeProperties()
|
RdfSerializerBuilder |
beansRequireDefaultConstructor()
|
RdfSerializerBuilder |
beansRequireSerializable()
|
RdfSerializerBuilder |
beansRequireSettersForGetters()
|
RdfSerializerBuilder |
bpi(Class<?> beanClass,
String properties)
Bean property includes.
|
RdfSerializerBuilder |
bpi(Map<String,Object> values)
Bean property includes.
|
RdfSerializerBuilder |
bpi(String beanClassName,
String properties)
Bean property includes.
|
RdfSerializerBuilder |
bpro(Class<?> beanClass,
String properties)
Read-only bean properties.
|
RdfSerializerBuilder |
bpro(Map<String,Object> values)
Read-only bean properties.
|
RdfSerializerBuilder |
bpro(String beanClassName,
String properties)
Read-only bean properties.
|
RdfSerializerBuilder |
bpwo(Class<?> beanClass,
String properties)
Write-only bean properties.
|
RdfSerializerBuilder |
bpwo(Map<String,Object> values)
Write-only bean properties.
|
RdfSerializerBuilder |
bpwo(String beanClassName,
String properties)
Write-only bean properties.
|
RdfSerializerBuilder |
bpx(Class<?> beanClass,
String properties)
Bean property excludes.
|
RdfSerializerBuilder |
bpx(Map<String,Object> values)
Bean property excludes.
|
RdfSerializerBuilder |
bpx(String beanClassName,
String properties)
Bean property excludes.
|
RdfSerializer |
build()
Build the object.
|
RdfSerializerBuilder |
collectionFormat(RdfCollectionFormat value)
|
RdfSerializerBuilder |
collectionFormat(String value)
|
RdfSerializerBuilder |
debug()
|
RdfSerializerBuilder |
detectRecursions()
|
RdfSerializerBuilder |
dictionary(Object... values)
|
RdfSerializerBuilder |
dictionaryOn(Class<?> on,
Class<?>... values)
|
RdfSerializerBuilder |
dontAutoDetectNamespaces()
|
RdfSerializerBuilder |
dontIgnorePropertiesWithoutSetters()
|
RdfSerializerBuilder |
dontIgnoreTransientFields()
|
RdfSerializerBuilder |
dontIgnoreUnknownNullBeanProperties()
|
RdfSerializerBuilder |
dontUseInterfaceProxies()
|
RdfSerializerBuilder |
dontUseXmlNamespaces()
|
<T> RdfSerializerBuilder |
example(Class<T> pojoClass,
T o)
|
<T> RdfSerializerBuilder |
exampleJson(Class<T> pojoClass,
String json)
|
RdfSerializerBuilder |
fileCharset(Charset value)
|
RdfSerializerBuilder |
fluentSetters()
|
RdfSerializerBuilder |
fluentSetters(Class<?> on)
|
RdfSerializerBuilder |
ignoreInvocationExceptionsOnGetters()
|
RdfSerializerBuilder |
ignoreInvocationExceptionsOnSetters()
|
RdfSerializerBuilder |
ignoreRecursions()
|
RdfSerializerBuilder |
ignoreUnknownBeanProperties()
|
RdfSerializerBuilder |
implClass(Class<?> interfaceClass,
Class<?> implClass)
|
RdfSerializerBuilder |
implClasses(Map<Class<?>,Class<?>> values)
|
RdfSerializerBuilder |
initialDepth(int value)
|
RdfSerializerBuilder |
interfaceClass(Class<?> on,
Class<?> value)
Identifies a class to be used as the interface class for the specified class and all subclasses.
|
RdfSerializerBuilder |
interfaces(Class<?>... value)
Identifies a set of interfaces.
|
RdfSerializerBuilder |
juneauBpNs(Namespace value)
|
RdfSerializerBuilder |
juneauBpNs(String value)
|
RdfSerializerBuilder |
juneauNs(Namespace value)
|
RdfSerializerBuilder |
juneauNs(String value)
|
RdfSerializerBuilder |
keepNullProperties()
|
RdfSerializerBuilder |
language(String value)
|
RdfSerializerBuilder |
listener(Class<? extends SerializerListener> value)
|
RdfSerializerBuilder |
locale(Locale value)
|
RdfSerializerBuilder |
looseCollections()
|
RdfSerializerBuilder |
looseCollections(boolean value)
|
RdfSerializerBuilder |
maxDepth(int value)
|
RdfSerializerBuilder |
maxIndent(int value)
|
RdfSerializerBuilder |
mediaType(MediaType value)
|
RdfSerializerBuilder |
n3_abbrevBaseUri(boolean value)
|
RdfSerializerBuilder |
n3_indentProperty(int value)
|
RdfSerializerBuilder |
n3_minGap(int value)
|
RdfSerializerBuilder |
n3_objectLists(boolean value)
|
RdfSerializerBuilder |
n3_propertyColumn(int value)
|
RdfSerializerBuilder |
n3_subjectColumn(int value)
|
RdfSerializerBuilder |
n3_useDoubles(boolean value)
|
RdfSerializerBuilder |
n3_usePropertySymbols(boolean value)
|
RdfSerializerBuilder |
n3_useTripleQuotedStrings(boolean value)
|
RdfSerializerBuilder |
n3_widePropertyLen(int value)
|
RdfSerializerBuilder |
n3()
|
RdfSerializerBuilder |
namespaces(Namespace... values)
|
RdfSerializerBuilder |
namespaces(String[] value)
|
RdfSerializerBuilder |
notBeanClasses(Object... values)
|
RdfSerializerBuilder |
notBeanPackages(Object... values)
|
RdfSerializerBuilder |
ntriple()
|
RdfSerializerBuilder |
prependTo(String name,
Object value)
Adds a free-form value to the beginning of a LIST property.
|
RdfSerializerBuilder |
propertyNamer(Class<?> on,
Class<? extends PropertyNamer> value)
Bean property namer
|
RdfSerializerBuilder |
propertyNamer(Class<? extends PropertyNamer> value)
|
RdfSerializerBuilder |
putAllTo(String name,
Object value)
Adds or overwrites multiple free-form entries in a MAP property.
|
RdfSerializerBuilder |
putTo(String name,
String key,
Object value)
Adds or overwrites a free-form entry in a MAP property.
|
RdfSerializerBuilder |
quoteChar(char value)
|
RdfSerializerBuilder |
rdfxml_allowBadUris(boolean value)
|
RdfSerializerBuilder |
rdfxml_attributeQuoteChar(String value)
|
RdfSerializerBuilder |
rdfxml_blockRules(String value)
|
RdfSerializerBuilder |
rdfxml_longId(boolean value)
|
RdfSerializerBuilder |
rdfxml_relativeUris(String value)
|
RdfSerializerBuilder |
rdfxml_showDoctypeDeclaration(boolean value)
|
RdfSerializerBuilder |
rdfxml_showXmlDeclaration(String value)
|
RdfSerializerBuilder |
rdfxml_tab(int value)
|
RdfSerializerBuilder |
rdfxml_xmlBase(String value)
|
RdfSerializerBuilder |
removeFrom(String name,
Object value)
Removes a free-form value from a SET, LIST, or MAP property.
|
RdfSerializerBuilder |
set(Map<String,Object> properties)
Sets multiple free-form configuration properties on this object replacing all previous values.
|
RdfSerializerBuilder |
set(String name,
Object value)
Sets a free-form configuration property on this object.
|
RdfSerializerBuilder |
sortCollections()
|
RdfSerializerBuilder |
sortMaps()
|
RdfSerializerBuilder |
sortProperties()
|
RdfSerializerBuilder |
sortProperties(Class<?>... on)
Sort bean properties.
|
RdfSerializerBuilder |
sq()
|
RdfSerializerBuilder |
stopClass(Class<?> on,
Class<?> value)
Identifies a stop class for the annotated class.
|
RdfSerializerBuilder |
streamCharset(Charset value)
|
RdfSerializerBuilder |
swaps(Object... values)
|
RdfSerializerBuilder |
timeZone(TimeZone value)
|
RdfSerializerBuilder |
trimEmptyCollections()
|
RdfSerializerBuilder |
trimEmptyMaps()
|
RdfSerializerBuilder |
trimStrings()
|
RdfSerializerBuilder |
turtle()
|
RdfSerializerBuilder |
typeName(Class<?> on,
String value)
An identifying name for this class.
|
RdfSerializerBuilder |
typePropertyName(Class<?> on,
String value)
|
RdfSerializerBuilder |
typePropertyName(String value)
|
RdfSerializerBuilder |
uriContext(UriContext value)
|
RdfSerializerBuilder |
uriRelativity(UriRelativity value)
|
RdfSerializerBuilder |
uriResolution(UriResolution value)
|
RdfSerializerBuilder |
useEnumNames()
|
RdfSerializerBuilder |
useJavaBeanIntrospector()
|
RdfSerializerBuilder |
useWhitespace()
|
RdfSerializerBuilder |
useXmlNamespaces(boolean value)
|
RdfSerializerBuilder |
ws()
|
RdfSerializerBuilder |
xml()
|
RdfSerializerBuilder |
xmlabbrev()
|
useWhitespace
addBeanTypes, addRootType, dontTrimNullProperties, keepNullProperties, sortCollections, sortMaps, trimEmptyCollections, trimEmptyMaps, trimNullProperties, trimStrings
detectRecursions, ignoreRecursions
beanDictionary, beanDictionary, beanDictionaryRemove, beanDictionaryRemove, beanDictionaryReplace, beanDictionaryReplace, beanFilters, beanFiltersRemove, beanFiltersReplace, beanMapPutReturnsOldValue, beansRequireDefaultConstructor, beansRequireSerializable, beansRequireSettersForGetters, beansRequireSomeProperties, debug, excludeProperties, excludeProperties, excludeProperties, fluentSetters, ignoreInvocationExceptionsOnGetters, ignoreInvocationExceptionsOnSetters, ignorePropertiesWithoutSetters, ignoreTransientFields, ignoreUnknownBeanProperties, ignoreUnknownNullBeanProperties, includeProperties, includeProperties, includeProperties, pojoSwaps, pojoSwapsRemove, pojoSwapsReplace, sortProperties, useEnumNames, useInterfaceProxies, useJavaBeanIntrospector
build, getPropertyStore, getPropertyStoreBuilder, peek, peek
public RdfSerializerBuilder addRootProperty
Shortcut for calling addRootProperty(
.
public RdfSerializerBuilder()
public RdfSerializerBuilder(PropertyStore ps)
ps
- The initial configuration settings for this builder.public RdfSerializer build()
ContextBuilder
build
in class WriterSerializerBuilder
public RdfSerializerBuilder juneauNs(String value)
value
- The new value for this property.public RdfSerializerBuilder juneauBpNs(String value)
value
- The new value for this property.public RdfSerializerBuilder arp_iriRules(String value)
Set the engine for checking and resolving.
Possible values:
value
- The new value for this property.public RdfSerializerBuilder arp_errorMode(String value)
This allows a coarse-grained approach to control of error handling.
Possible values:
value
- The new value for this property.public RdfSerializerBuilder arp_embedding(boolean value)
Sets ARP to look for RDF embedded within an enclosing XML document.
value
- The new value for this property.public RdfSerializerBuilder rdfxml_xmlBase(String value)
The value to be included for an
value
- The new value for this property.public RdfSerializerBuilder rdfxml_longId(boolean value)
Whether to use long ID's for anon resources. Short ID's are easier to read, but can run out of memory on very large models.
value
- The new value for this property.public RdfSerializerBuilder rdfxml_allowBadUris(boolean value)
URIs in the graph are, by default, checked prior to serialization.
value
- The new value for this property.public RdfSerializerBuilder rdfxml_relativeUris(String value)
What sort of relative URIs should be used.
A comma separate list of options:
The default value is
value
- The new value for this property.public RdfSerializerBuilder rdfxml_showXmlDeclaration(String value)
Possible values:
value
- The new value for this property.public RdfSerializerBuilder rdfxml_showDoctypeDeclaration(boolean value)
If true, an XML doctype declaration is included in the output.
This declaration includes a
value
- The new value for this property.public RdfSerializerBuilder rdfxml_tab(int value)
The number of spaces with which to indent XML child elements.
value
- The new value for this property.public RdfSerializerBuilder rdfxml_attributeQuoteChar(String value)
The XML attribute quote character.
value
- The new value for this property.public RdfSerializerBuilder rdfxml_blockRules(String value)
A list of
value
- The new value for this property.public RdfSerializerBuilder n3_minGap(int value)
Minimum gap between items on a line.
value
- The new value for this property.public RdfSerializerBuilder n3_objectLists(boolean value)
Print object lists as comma separated lists.
value
- The new value for this property.public RdfSerializerBuilder n3_subjectColumn(int value)
If the subject is shorter than this value, the first property may go on the same line.
value
- The new value for this property.public RdfSerializerBuilder n3_propertyColumn(int value)
Width of the property column.
value
- The new value for this property.public RdfSerializerBuilder n3_indentProperty(int value)
Width to indent properties.
value
- The new value for this property.public RdfSerializerBuilder n3_widePropertyLen(int value)
Width of the property column.
Must be longer than
value
- The new value for this property.public RdfSerializerBuilder n3_abbrevBaseUri(boolean value)
Control whether to use abbreviations
value
- The new value for this property.public RdfSerializerBuilder n3_usePropertySymbols(boolean value)
Control whether to use
value
- The new value for this property.public RdfSerializerBuilder n3_useTripleQuotedStrings(boolean value)
Allow the use of
value
- The new value for this property.public RdfSerializerBuilder n3_useDoubles(boolean value)
Allow the use doubles as
value
- The new value for this property.public RdfSerializerBuilder collectionFormat(String value)
Possible values:
value
- The new value for this property.public RdfSerializerBuilder namespaces(String[] value)
The default list of namespaces associated with this serializer.
value
- The new value for this property.public RdfSerializerBuilder addLiteralTypes(boolean value)
value
- The new value for this property.
public RdfSerializerBuilder addLiteralTypes()
Shortcut for calling addLiteralTypes(
.
public RdfSerializerBuilder addRootProperty(boolean value)
When enabled an RDF property
If disabled, the parser has to search through the model to find any resources without incoming predicates to identify root notes, which can introduce a considerable performance degradation.
value
- The new value for this property.
public RdfSerializerBuilder addRootProperty()
Shortcut for calling addRootProperty(
.
public RdfSerializerBuilder autoDetectNamespaces(boolean value)
Detect namespace usage before serialization.
value
- The new value for this property.
public RdfSerializerBuilder dontAutoDetectNamespaces()
Detect namespace usage before serialization.
public RdfSerializerBuilder collectionFormat(RdfCollectionFormat value)
value
- The new value for this property.
public RdfSerializerBuilder juneauBpNs(Namespace value)
value
- The new value for this property.
{j:'http://www.apache.org/juneaubp/' }
.public RdfSerializerBuilder juneauNs(Namespace value)
value
- The new value for this property.
{j:'http://www.apache.org/juneau/' }
.public RdfSerializerBuilder language(String value)
Can be any of the following:
value
- The new value for this property.public RdfSerializerBuilder looseCollections(boolean value)
When specified, collections of resources are handled as loose collections of resources in RDF instead of resources that are children of an RDF collection (e.g. Sequence, Bag).
value
- The new value for this property.
public RdfSerializerBuilder looseCollections()
Shortcut for looseCollections(
.
public RdfSerializerBuilder n3()
Shortcut for calling language(
public RdfSerializerBuilder namespaces(Namespace... values)
The default list of namespaces associated with this serializer.
values
- The new value for this property.public RdfSerializerBuilder ntriple()
Shortcut for calling language(
public RdfSerializerBuilder turtle()
Shortcut for calling language(
public RdfSerializerBuilder useXmlNamespaces(boolean value)
When specified, namespaces defined using @XmlNs
and Xml
will be
inherited by the RDF serializers.
Otherwise, namespaces will be defined using @RdfNs
and @Rdf
.
value
- The new value for this property.
public RdfSerializerBuilder dontUseXmlNamespaces()
When specified, namespaces defined using @XmlNs
and Xml
will be
inherited by the RDF serializers.
Otherwise, namespaces will be defined using @RdfNs
and @Rdf
.
public RdfSerializerBuilder xml()
Shortcut for calling language(
public RdfSerializerBuilder xmlabbrev()
Shortcut for calling language(
public RdfSerializerBuilder add(Map<String,Object> properties)
ContextBuilder
Identical in function to ContextBuilder.set(String, Object)
but allows you to specify multiple values at once.
add
in class WriterSerializerBuilder
properties
- The properties to set on this class.
public RdfSerializerBuilder addTo(String name, Object value)
ContextBuilder
SET properties are those properties with one of the following type parts:
For example, the BeanContext.BEAN_notBeanClasses
property which has the value
addTo
in class WriterSerializerBuilder
name
- The property name.value
- The new value to add to the SET property.
public RdfSerializerBuilder appendTo(String name, Object value)
ContextBuilder
LIST properties are those properties with one of the following type parts:
For example, the BeanContext.BEAN_swaps
property which has the value
appendTo
in class WriterSerializerBuilder
name
- The property name.value
- The new value to add to the LIST property.
public RdfSerializerBuilder apply(PropertyStore copyFrom)
ContextBuilder
apply
in class WriterSerializerBuilder
copyFrom
- The property store whose settings are being copied.public RdfSerializerBuilder applyAnnotations(Class<?>... fromClasses)
ContextBuilder
Any annotations found that themselves are annotated with PropertyStoreApply
will be resolved and
applied as properties to this builder. These annotations include:
BeanConfig
CsvConfig
HtmlConfig
HtmlDocConfig
JsoConfig
JsonConfig
JsonSchemaConfig
MsgPackConfig
OpenApiConfig
ParserConfig
PlainTextConfig
SerializerConfig
SoapXmlConfig
UonConfig
UrlEncodingConfig
XmlConfig
Annotations on classes are appended in the following order:
The default var resolver VarResolver.DEFAULT
is used to resolve any variables in annotation field values.
applyAnnotations
in class WriterSerializerBuilder
fromClasses
- The classes on which the annotations are defined.public RdfSerializerBuilder applyAnnotations(Method... fromMethods)
ContextBuilder
Any annotations found that themselves are annotated with PropertyStoreApply
will be resolved and
applied as properties to this builder. These annotations include:
BeanConfig
CsvConfig
HtmlConfig
HtmlDocConfig
JsoConfig
JsonConfig
JsonSchemaConfig
MsgPackConfig
OpenApiConfig
ParserConfig
PlainTextConfig
SerializerConfig
SoapXmlConfig
UonConfig
UrlEncodingConfig
XmlConfig
Annotations on methods are appended in the following order:
The default var resolver VarResolver.DEFAULT
is used to resolve any variables in annotation field values.
applyAnnotations
in class WriterSerializerBuilder
fromMethods
- The methods on which the annotations are defined.public RdfSerializerBuilder applyAnnotations(AnnotationList al, VarResolverSession r)
ContextBuilder
The AnnotationList
object is an ordered list of annotations and the classes/methods/packages they were found on.
applyAnnotations
in class WriterSerializerBuilder
al
- The list of all annotations annotated with PropertyStoreApply
.r
- The string resolver for resolving variables in annotation values.public RdfSerializerBuilder debug()
ContextBuilder
Enables the following additional information during serialization:
BeanTraverseContext.BEANTRAVERSE_detectRecursions
.
Enables the following additional information during parsing:
debug
in class WriterSerializerBuilder
public RdfSerializerBuilder locale(Locale value)
ContextBuilder
Specifies the default locale for serializer and parser sessions when not specified via SessionArgs.locale(Locale)
.
Typically used for POJO swaps that need to deal with locales such as swaps that convert PojoSwap.swap(BeanSession, Object)
and
PojoSwap.unswap(BeanSession, Object, ClassMeta, String)
methods.
locale
in class WriterSerializerBuilder
value
- The new value for this property.public RdfSerializerBuilder mediaType(MediaType value)
ContextBuilder
Specifies the default media type for serializer and parser sessions when not specified via SessionArgs.mediaType(MediaType)
.
Typically used for POJO swaps that need to serialize the same POJO classes differently depending on
the specific requested media type. For example, a swap could handle a request for media types
mediaType
in class WriterSerializerBuilder
value
- The new value for this property.public RdfSerializerBuilder prependTo(String name, Object value)
ContextBuilder
LIST properties are those properties with one of the following type parts:
For example, the BeanContext.BEAN_swaps
property which has the value
prependTo
in class WriterSerializerBuilder
name
- The property name.value
- The new value to add to the LIST property.
public RdfSerializerBuilder putAllTo(String name, Object value)
ContextBuilder
MAP properties are those properties with one of the following type parts:
For example, the BeanContext.BEAN_implClasses
property which has the value
putAllTo
in class WriterSerializerBuilder
name
- The property name.value
- Either a JSON Object string or a Map
whose valid value types depend on the property type:
public RdfSerializerBuilder putTo(String name, String key, Object value)
ContextBuilder
MAP properties are those properties with one of the following type parts:
For example, the BeanContext.BEAN_implClasses
property which has the value
putTo
in class WriterSerializerBuilder
name
- The property name.key
- The property value map key.value
- The property value map value.
public RdfSerializerBuilder removeFrom(String name, Object value)
ContextBuilder
removeFrom
in class WriterSerializerBuilder
name
- The property name.value
- The property value in the SET/LIST/MAP property.public RdfSerializerBuilder set(Map<String,Object> properties)
ContextBuilder
Identical in function to ContextBuilder.set(String, Object)
but allows you to specify multiple values at once.
set
in class WriterSerializerBuilder
properties
- The properties to set on this class.
public RdfSerializerBuilder set(String name, Object value)
ContextBuilder
Provides the ability to specify configuration property values in a generic fashion.
Property names must have the following format that identify their datatype...
...where the parts consist of the following...
For example,
Property values get 'normalized' when they get set.
For example, calling PropertyStore
class to be comparable
and useful in determining whether a cached instance of a context object can be returned.
As a general rule, builders don't typically have "unsetter" methods. For example, once you've set strict
mode on the
set
in class WriterSerializerBuilder
name
- The property name.value
- The property value.
public RdfSerializerBuilder timeZone(TimeZone value)
ContextBuilder
Specifies the default time zone for serializer and parser sessions when not specified via SessionArgs.timeZone(TimeZone)
.
Typically used for POJO swaps that need to deal with timezones such as swaps that convert PojoSwap.swap(BeanSession, Object)
and
PojoSwap.unswap(BeanSession, Object, ClassMeta, String)
methods.
timeZone
in class WriterSerializerBuilder
value
- The new value for this property.public RdfSerializerBuilder annotations(Annotation... values)
BeanContextBuilder
Defines annotations to apply to specific classes and methods.
Allows you to dynamically apply Juneau annotations typically applied directly to classes and methods. Useful in cases where you want to use the functionality of the annotation on beans and bean properties but do not have access to the code to do so.
As a rule, any Juneau annotation with an
The following example shows the equivalent methods for applying the @Bean
annotation:
In general, the underlying framework uses this method when it finds dynamically applied annotations on config annotations. However, concrete implementations of annotations are also provided that can be passed directly into builder classes like so:
The following is the list of concrete annotations provided that can be constructed and passed into the builder class:
BeanAnnotation
BeancAnnotation
BeanIgnoreAnnotation
BeanpAnnotation
ExampleAnnotation
NamePropertyAnnotation
ParentPropertyAnnotation
SwapAnnotation
UriAnnotation
CsvAnnotation
HtmlAnnotation
JsoAnnotation
JsonAnnotation
SchemaAnnotation
MsgPackAnnotation
OpenApiAnnotation
PlainTextAnnotation
SoapXmlAnnotation
UonAnnotation
UrlEncodingAnnotation
XmlAnnotation
The syntax for the
annotations
in class WriterSerializerBuilder
values
- The values to add to this property.public RdfSerializerBuilder beanClassVisibility(Visibility value)
BeanContextBuilder
Classes are not considered beans unless they meet the minimum visibility requirements.
For example, if the visibility is
@Bean
annotation can be used on a non-public bean class to override this setting.
@BeanIgnore
annotation can also be used on a public bean class to ignore it as a bean.
beanClassVisibility
in class WriterSerializerBuilder
value
- The new value for this property.
Visibility.PUBLIC
.public RdfSerializerBuilder beanConstructorVisibility(Visibility value)
BeanContextBuilder
Only look for constructors with the specified minimum visibility.
This setting affects the logic for finding no-arg constructors for bean. Normally, only
@Beanc
annotation can also be used to expose a non-public constructor.
@BeanIgnore
annotation can also be used on a public bean constructor to ignore it.
beanConstructorVisibility
in class WriterSerializerBuilder
value
- The new value for this property.
Visibility.PUBLIC
.public RdfSerializerBuilder beanFieldVisibility(Visibility value)
BeanContextBuilder
Only look for bean fields with the specified minimum visibility.
This affects which fields on a bean class are considered bean properties. Normally only
Bean fields can be ignored as properties entirely by setting the value to Visibility.NONE
@Beanp
annotation can also be used to expose a non-public field.
@BeanIgnore
annotation can also be used on a public bean field to ignore it as a bean property.
beanFieldVisibility
in class WriterSerializerBuilder
value
- The new value for this property.
Visibility.PUBLIC
.public RdfSerializerBuilder beanInterceptor(Class<?> on, Class<? extends BeanInterceptor<?>> value)
BeanContextBuilder
Bean interceptors can be used to intercept calls to getters and setters and alter their values in transit.
beanInterceptor
in class WriterSerializerBuilder
on
- The bean that the filter applies to.value
- The new value for this property.public RdfSerializerBuilder beanMapPutReturnsOldValue()
BeanContextBuilder
When enabled, then the BeanMap.put()
method will return old property
values. Otherwise, it returns
Disabled by default because it introduces a slight performance penalty during serialization.
beanMapPutReturnsOldValue
in class WriterSerializerBuilder
public RdfSerializerBuilder beanMethodVisibility(Visibility value)
BeanContextBuilder
Only look for bean methods with the specified minimum visibility.
This affects which methods are detected as getters and setters on a bean class. Normally only
@Beanp
annotation can also be used to expose a non-public method.
@BeanIgnore
annotation can also be used on a public bean getter/setter to ignore it as a bean property.
beanMethodVisibility
in class WriterSerializerBuilder
value
- The new value for this property.
Visibility.PUBLIC
public RdfSerializerBuilder beansDontRequireSomeProperties()
BeanContextBuilder
When enabled, then a Java class must contain at least 1 property to be considered a bean.
Otherwise, the bean will be serialized as a string using the Object.toString()
method.
The @Bean
annotation can be used on a class to override this setting when
@Bean
annotation can be used on the class to force it to be recognized as a bean class
even if it has no properties.
beansDontRequireSomeProperties
in class WriterSerializerBuilder
public RdfSerializerBuilder beansRequireDefaultConstructor()
BeanContextBuilder
When enabled, a Java class must implement a default no-arg constructor to be considered a bean.
Otherwise, the bean will be serialized as a string using the Object.toString()
method.
@Bean
annotation can be used on a bean class to override this setting.
@BeanIgnore
annotation can also be used on a class to ignore it as a bean.
beansRequireDefaultConstructor
in class WriterSerializerBuilder
public RdfSerializerBuilder beansRequireSerializable()
BeanContextBuilder
When enabled, a Java class must implement the Serializable
interface to be considered a bean.
Otherwise, the bean will be serialized as a string using the Object.toString()
method.
@Bean
annotation can be used on a bean class to override this setting.
@BeanIgnore
annotation can also be used on a class to ignore it as a bean.
beansRequireSerializable
in class WriterSerializerBuilder
public RdfSerializerBuilder beansRequireSettersForGetters()
BeanContextBuilder
When enabled, ignore read-only properties (properties with getters but not setters).
@Beanp
annotation can be used on the getter to override this setting.
@BeanIgnore
annotation can also be used on getters to ignore them as bean properties.
beansRequireSettersForGetters
in class WriterSerializerBuilder
public RdfSerializerBuilder bpi(Map<String,Object> values)
BeanContextBuilder
Specifies the set and order of names of properties associated with bean classes.
For example, BeanContextBuilder.ignoreUnknownBeanProperties()
has been called.
This value is entirely optional if you simply want to expose all the getters and public fields on a class as bean properties. However, it's useful if you want certain getters to be ignored or you want the properties to be serialized in a particular order. Note that on IBM JREs, the property order is the same as the order in the source code, whereas on Oracle JREs, the order is entirely random.
Setting applies to specified class and all subclasses.
This method is functionally equivalent to the following code for each entry:
builder.annotations(
Bean.bpi()
- On an annotation on the bean class itself.
BeanConfig.bpi()
- On a bean config annotation (see BeanContextBuilder.annotations(Annotation...)
).
bpi
in class WriterSerializerBuilder
values
- The values to add to this builder.
public RdfSerializerBuilder bpi(Class<?> beanClass, String properties)
BeanContextBuilder
Specifies the set and order of names of properties associated with the bean class.
For example, BeanContextBuilder.ignoreUnknownBeanProperties()
has been called.
This value is entirely optional if you simply want to expose all the getters and public fields on a class as bean properties. However, it's useful if you want certain getters to be ignored or you want the properties to be serialized in a particular order. Note that on IBM JREs, the property order is the same as the order in the source code, whereas on Oracle JREs, the order is entirely random.
Setting applies to specified class and all subclasses.
This method is functionally equivalent to the following code:
builder.annotations(
Bean.bpi()
- On an annotation on the bean class itself.
BeanConfig.bpi()
- On a bean config annotation (see BeanContextBuilder.annotations(Annotation...)
).
bpi
in class WriterSerializerBuilder
beanClass
- The bean class.properties
- Comma-delimited list of property names.public RdfSerializerBuilder bpi(String beanClassName, String properties)
BeanContextBuilder
Specifies the set and order of names of properties associated with the bean class.
For example, BeanContextBuilder.ignoreUnknownBeanProperties()
has been called.
This value is entirely optional if you simply want to expose all the getters and public fields on a class as bean properties. However, it's useful if you want certain getters to be ignored or you want the properties to be serialized in a particular order. Note that on IBM JREs, the property order is the same as the order in the source code, whereas on Oracle JREs, the order is entirely random.
Setting applies to specified class and all subclasses.
This method is functionally equivalent to the following code:
builder.annotations(
Bean.bpi()
- On an annotation on the bean class itself.
BeanConfig.bpi()
- On a bean config annotation (see BeanContextBuilder.annotations(Annotation...)
).
bpi
in class WriterSerializerBuilder
beanClassName
- The bean class name.
properties
- Comma-delimited list of property names.public RdfSerializerBuilder bpro(Map<String,Object> values)
BeanContextBuilder
Specifies one or more properties on beans that are read-only despite having valid getters.
Serializers will serialize such properties as usual, but parsers will silently ignore them.
Note that this is different from the
This method is functionally equivalent to the following code for each entry:
builder.annotations(
bpro
in class WriterSerializerBuilder
values
- The values to add to this builder.
public RdfSerializerBuilder bpro(Class<?> beanClass, String properties)
BeanContextBuilder
Specifies one or more properties on a bean that are read-only despite having valid getters.
Serializers will serialize such properties as usual, but parsers will silently ignore them.
Note that this is different from the
This method is functionally equivalent to the following code:
builder.annotations(
bpro
in class WriterSerializerBuilder
beanClass
- The bean class.properties
- Comma-delimited list of property names.public RdfSerializerBuilder bpro(String beanClassName, String properties)
BeanContextBuilder
Specifies one or more properties on a bean that are read-only despite having valid getters.
Serializers will serialize such properties as usual, but parsers will silently ignore them.
Note that this is different from the
This method is functionally equivalent to the following code:
builder.annotations(
bpro
in class WriterSerializerBuilder
beanClassName
- The bean class name.
properties
- Comma-delimited list of property names.public RdfSerializerBuilder bpwo(Map<String,Object> values)
BeanContextBuilder
Specifies one or more properties on a bean that are write-only despite having valid setters.
Parsers will parse such properties as usual, but serializers will silently ignore them.
Note that this is different from the
This method is functionally equivalent to the following code for each entry:
builder.annotations(
bpwo
in class WriterSerializerBuilder
values
- The values to add to this builder.
public RdfSerializerBuilder bpwo(Class<?> beanClass, String properties)
BeanContextBuilder
Specifies one or more properties on a bean that are write-only despite having valid setters.
Parsers will parse such properties as usual, but serializers will silently ignore them.
Note that this is different from the
This method is functionally equivalent to the following code:
builder.annotations(
bpwo
in class WriterSerializerBuilder
beanClass
- The bean class.properties
- Comma-delimited list of property names.public RdfSerializerBuilder bpwo(String beanClassName, String properties)
BeanContextBuilder
Specifies one or more properties on a bean that are write-only despite having valid setters.
Parsers will parse such properties as usual, but serializers will silently ignore them.
Note that this is different from the
This method is functionally equivalent to the following code:
builder.annotations(
bpwo
in class WriterSerializerBuilder
beanClassName
- The bean class name.
properties
- Comma-delimited list of property names.public RdfSerializerBuilder bpx(Map<String,Object> values)
BeanContextBuilder
Specifies to exclude the specified list of properties for the specified bean classes.
Same as BeanContextBuilder.bpi(Map)
except you specify a list of bean property names that you want to exclude from
serialization.
Setting applies to specified class and all subclasses.
This method is functionally equivalent to the following code for each entry:
builder.annotations(
bpx
in class WriterSerializerBuilder
values
- The values to add to this builder.
public RdfSerializerBuilder bpx(Class<?> beanClass, String properties)
BeanContextBuilder
Specifies to exclude the specified list of properties for the specified bean class.
Same as BeanContextBuilder.bpi(Class, String)
except you specify a list of bean property names that you want to exclude from
serialization.
Setting applies to specified class and all subclasses.
This method is functionally equivalent to the following code:
builder.annotations(
bpx
in class WriterSerializerBuilder
beanClass
- The bean class.properties
- Comma-delimited list of property names.public RdfSerializerBuilder bpx(String beanClassName, String properties)
BeanContextBuilder
Specifies to exclude the specified list of properties for the specified bean class.
Same as BeanContextBuilder.bpx(String, String)
except you specify a list of bean property names that you want to exclude from
serialization.
Setting applies to specified class and all subclasses.
This method is functionally equivalent to the following code:
builder.annotations(
bpx
in class WriterSerializerBuilder
beanClassName
- The bean class name.
properties
- Comma-delimited list of property names.public RdfSerializerBuilder dictionary(Object... values)
BeanContextBuilder
The list of classes that make up the bean dictionary in this bean context.
A dictionary is a name/class mapping used to find class types during parsing when they cannot be inferred
through reflection. The names are defined through the @Bean(typeName)
annotation defined
on the bean class. For example, if a class
This setting tells the parsers which classes to look for when resolving
Values can consist of any of the following types:
@Bean(typeName)
.
BeanDictionaryList
containing a collection of bean classes with type name annotations.
BeanDictionaryMap
containing a mapping of type names to classes without type name annotations.
Another option is to use the Bean.dictionary()
annotation on the POJO class itself:
A typical usage is to allow for HTML documents to be parsed back into HTML beans:
dictionary
in class WriterSerializerBuilder
values
- The values to add to this property.public RdfSerializerBuilder dictionaryOn(Class<?> on, Class<?>... values)
BeanContextBuilder
This is identical to BeanContextBuilder.dictionary(Object...)
, but specifies a dictionary within the context of
a single class as opposed to globally.
This is functionally equivalent to the Bean.dictionary()
annotation.
dictionaryOn
in class WriterSerializerBuilder
on
- The class that the dictionary values apply to.values
- The new values for this property.public RdfSerializerBuilder dontIgnorePropertiesWithoutSetters()
BeanContextBuilder
When enabled, trying to set a value on a bean property without a setter will silently be ignored.
Otherwise, a BeanRuntimeException
is thrown.
@BeanIgnore
annotation can also be used on getters and fields to ignore them.
dontIgnorePropertiesWithoutSetters
in class WriterSerializerBuilder
public RdfSerializerBuilder dontIgnoreTransientFields()
BeanContextBuilder
When enabled, methods and fields marked as
@Beanp
annotation can also be used on transient fields to keep them from being ignored.
dontIgnoreTransientFields
in class WriterSerializerBuilder
public RdfSerializerBuilder dontIgnoreUnknownNullBeanProperties()
BeanContextBuilder
When enabled, trying to set a BeanRuntimeException
is thrown.
dontIgnoreUnknownNullBeanProperties
in class WriterSerializerBuilder
public RdfSerializerBuilder dontUseInterfaceProxies()
BeanContextBuilder
When enabled, interfaces will be instantiated as proxy classes through the use of an
InvocationHandler
if there is no other way of instantiating them.
Otherwise, throws a BeanRuntimeException
.
dontUseInterfaceProxies
in class WriterSerializerBuilder
public <T> RdfSerializerBuilder example(Class<T> pojoClass, T o)
BeanContextBuilder
Specifies an example of the specified class.
Examples are used in cases such as POJO examples in Swagger documents.
Setting applies to specified class and all subclasses.
POJO examples can also be defined on classes via the following:
@Example
.
@Example
with zero arguments or one BeanSession
argument.
BeanSession
argument.
example
in class WriterSerializerBuilder
pojoClass
- The POJO class.o
- An instance of the POJO class used for examples.public <T> RdfSerializerBuilder exampleJson(Class<T> pojoClass, String json)
BeanContextBuilder
Specifies an example in JSON of the specified class.
Examples are used in cases such as POJO examples in Swagger documents.
Setting applies to specified class and all subclasses.
POJO examples can also be defined on classes via the following:
@Example
.
@Example
with zero arguments or one BeanSession
argument.
BeanSession
argument.
exampleJson
in class WriterSerializerBuilder
T
- The POJO class type.pojoClass
- The POJO class.json
- The simple JSON representation of the example.public RdfSerializerBuilder fluentSetters()
BeanContextBuilder
When enabled, fluent setters are detected on beans during parsing.
Fluent setters must have the following attributes:
@Beanp
annotation can also be used on methods to individually identify them as fluent setters.
@Bean.fluentSetters()
annotation can also be used on classes to specify to look for fluent setters.
fluentSetters
in class WriterSerializerBuilder
public RdfSerializerBuilder fluentSetters(Class<?> on)
BeanContextBuilder
Identical to BeanContextBuilder.fluentSetters()
but enables it on a specific class only.
Bean.fluentSetters()
annotation.
fluentSetters
in class WriterSerializerBuilder
on
- The class that this applies to.public RdfSerializerBuilder ignoreInvocationExceptionsOnGetters()
BeanContextBuilder
When enabled, errors thrown when calling bean getter methods will silently be ignored.
Otherwise, a BeanRuntimeException
is thrown.
ignoreInvocationExceptionsOnGetters
in class WriterSerializerBuilder
public RdfSerializerBuilder ignoreInvocationExceptionsOnSetters()
BeanContextBuilder
When enabled, errors thrown when calling bean setter methods will silently be ignored.
Otherwise, a BeanRuntimeException
is thrown.
ignoreInvocationExceptionsOnSetters
in class WriterSerializerBuilder
public RdfSerializerBuilder ignoreUnknownBeanProperties()
BeanContextBuilder
When enabled, trying to set a value on a non-existent bean property will silently be ignored.
Otherwise, a BeanRuntimeException
is thrown.
ignoreUnknownBeanProperties
in class WriterSerializerBuilder
public RdfSerializerBuilder implClass(Class<?> interfaceClass, Class<?> implClass)
BeanContextBuilder
For interfaces and abstract classes this method can be used to specify an implementation class for the interface/abstract class so that instances of the implementation class are used when instantiated (e.g. during a parse).
implClass
in class WriterSerializerBuilder
interfaceClass
- The interface class.implClass
- The implementation class.public RdfSerializerBuilder implClasses(Map<Class<?>,Class<?>> values)
BeanContextBuilder
For interfaces and abstract classes this method can be used to specify an implementation class for the interface/abstract class so that instances of the implementation class are used when instantiated (e.g. during a parse).
implClasses
in class WriterSerializerBuilder
values
- The new value for this property.public RdfSerializerBuilder interfaceClass(Class<?> on, Class<?> value)
BeanContextBuilder
When specified, only the list of properties defined on the interface class will be used during serialization. Additional properties on subclasses will be ignored.
This annotation can be used on the parent class so that it filters to all child classes, or can be set individually on the child classes.
@Bean(interfaceClass)
annotation is the equivalent annotation-based solution.
interfaceClass
in class WriterSerializerBuilder
on
- The class that the interface class applies to.value
- The new value for this property.public RdfSerializerBuilder interfaces(Class<?>... value)
BeanContextBuilder
When specified, only the list of properties defined on the interface class will be used during serialization of implementation classes. Additional properties on subclasses will be ignored.
This annotation can be used on the parent class so that it filters to all child classes, or can be set individually on the child classes.
@Bean(interfaceClass)
annotation is the equivalent annotation-based solution.
interfaces
in class WriterSerializerBuilder
value
- The new value for this property.public RdfSerializerBuilder notBeanClasses(Object... values)
BeanContextBuilder
List of classes that should not be treated as beans even if they appear to be bean-like.
Not-bean classes are converted to
Values can consist of any of the following types:
@BeanIgnore
annotation can also be used on classes to prevent them from being recognized as beans.
notBeanClasses
in class WriterSerializerBuilder
values
- The values to add to this property.
public RdfSerializerBuilder notBeanPackages(Object... values)
BeanContextBuilder
Used as a convenient way of defining the BeanContextBuilder.notBeanClasses(Object...)
property for entire packages.
Any classes within these packages will be serialized to strings using Object.toString()
.
Note that you can specify suffix patterns to include all subpackages.
Values can consist of any of the following types:
notBeanPackages
in class WriterSerializerBuilder
values
- The values to add to this property.
Package
objects.
public RdfSerializerBuilder propertyNamer(Class<? extends PropertyNamer> value)
BeanContextBuilder
The class to use for calculating bean property names.
Predefined classes:
PropertyNamerDefault
- Default.
PropertyNamerDLC
- Dashed-lower-case names.
PropertyNamerULC
- Dashed-upper-case names.
propertyNamer
in class WriterSerializerBuilder
value
- The new value for this setting.
PropertyNamerDefault
.public RdfSerializerBuilder propertyNamer(Class<?> on, Class<? extends PropertyNamer> value)
BeanContextBuilder
Same as BeanContextBuilder.propertyNamer(Class)
but allows you to specify a namer for a specific class.
propertyNamer
in class WriterSerializerBuilder
on
- The class that the namer applies to.value
- The new value for this setting.
PropertyNamerDefault
.public RdfSerializerBuilder sortProperties()
BeanContextBuilder
When enabled, all bean properties will be serialized and access in alphabetical order. Otherwise, the natural order of the bean properties is used which is dependent on the JVM vendor. On IBM JVMs, the bean properties are ordered based on their ordering in the Java file. On Oracle JVMs, the bean properties are not ordered (which follows the official JVM specs).
This property is disabled by default so that IBM JVM users don't have to use @Bean
annotations
to force bean properties to be in a particular order and can just alter the order of the fields/methods
in the Java file.
@Bean.sort()
annotation can also be used to sort properties on just a single class.
sortProperties
in class WriterSerializerBuilder
public RdfSerializerBuilder sortProperties(Class<?>... on)
BeanContextBuilder
Same as BeanContextBuilder.sortProperties()
but allows you to specify individual bean classes instead of globally.
sortProperties
in class WriterSerializerBuilder
on
- The bean classes to sort properties on.public RdfSerializerBuilder stopClass(Class<?> on, Class<?> value)
BeanContextBuilder
Identical in purpose to the stop class specified by Introspector.getBeanInfo(Class, Class)
.
Any properties in the stop class or in its base classes will be ignored during analysis.
For example, in the following class hierarchy, instances of
stopClass
in class WriterSerializerBuilder
on
- The class on which the stop class is being applied.value
- The new value for this property.public RdfSerializerBuilder swaps(Object... values)
BeanContextBuilder
Swaps are used to "swap out" non-serializable classes with serializable equivalents during serialization, and "swap in" the non-serializable class during parsing.
An example of a swap would be a
Multiple swaps can be associated with a single class.
When multiple swaps are applicable to the same class, the media type pattern defined by
PojoSwap.forMediaTypes()
or @Swap(mediaTypes)
are used to come up with the best match.
Values can consist of any of the following types:
PojoSwap
.
PojoSwap
.
SurrogateSwap
.
swaps
in class WriterSerializerBuilder
values
- The values to add to this property.
PojoSwap
.
SurrogateSwap
.
public RdfSerializerBuilder typeName(Class<?> on, String value)
BeanContextBuilder
The name is used to identify the class type during parsing when it cannot be inferred through reflection.
For example, if a bean property is of type
It is also used to specify element names in XML.
Bean(typeName)
annotation.
typeName
in class WriterSerializerBuilder
on
- The class the type name is being defined on.value
- The new value for this property.public RdfSerializerBuilder typePropertyName(String value)
BeanContextBuilder
This specifies the name of the bean property used to store the dictionary name of a bean type so that the parser knows the data type to reconstruct.
typePropertyName
in class WriterSerializerBuilder
value
- The new value for this property.
public RdfSerializerBuilder typePropertyName(Class<?> on, String value)
BeanContextBuilder
Same as BeanContextBuilder.typePropertyName(String)
except targets a specific bean class instead of globally.
typePropertyName
in class WriterSerializerBuilder
on
- The class the type property name applies to.value
- The new value for this property.
public RdfSerializerBuilder useEnumNames()
BeanContextBuilder
When enabled, enums are always serialized by name, not using Object.toString()
.
useEnumNames
in class WriterSerializerBuilder
public RdfSerializerBuilder useJavaBeanIntrospector()
BeanContextBuilder
Using the built-in Java bean introspector will not pick up fields or non-standard getters/setters.
Most @Bean
annotations will be ignored.
useJavaBeanIntrospector
in class WriterSerializerBuilder
public RdfSerializerBuilder detectRecursions()
BeanTraverseBuilder
When enabled, specifies that recursions should be checked for during traversal.
Recursions can occur when traversing models that aren't true trees but rather contain loops.
In general, unchecked recursions cause stack-overflow-errors.
These show up as BeanRecursionException
with the message
detectRecursions
in class WriterSerializerBuilder
public RdfSerializerBuilder ignoreRecursions()
BeanTraverseBuilder
When enabled, when we encounter the same object when traversing a tree, we set the value to
For example, if a model contains the links A->B->C->A, then the JSON generated will look like
the following when
{A:{B:{C:
ignoreRecursions
in class WriterSerializerBuilder
public RdfSerializerBuilder initialDepth(int value)
BeanTraverseBuilder
The initial indentation level at the root.
Useful when constructing document fragments that need to be indented at a certain level when whitespace is enabled.
initialDepth
in class WriterSerializerBuilder
value
- The new value for this property.
public RdfSerializerBuilder maxDepth(int value)
BeanTraverseBuilder
When enabled, abort traversal if specified depth is reached in the POJO tree.
If this depth is exceeded, an exception is thrown.
This prevents stack overflows from occurring when trying to traverse models with recursive references.
maxDepth
in class WriterSerializerBuilder
value
- The new value for this property.
public RdfSerializerBuilder addBeanTypes()
SerializerBuilder
When enabled,
This is used to recreate the correct objects during parsing if the object types cannot be inferred.
For example, when serializing a
Note the differences between the following settings:
SerializerBuilder.addRootType()
- Affects whether SerializerBuilder.addBeanTypes()
- Affects whether
addBeanTypes
in class WriterSerializerBuilder
public RdfSerializerBuilder addRootType()
SerializerBuilder
When enabled,
When disabled, it is assumed that the parser knows the exact Java POJO type being parsed, and therefore top-level type information that might normally be included to determine the data type will not be serialized.
For example, when serializing a top-level POJO with a @Bean(typeName)
value, a
Note the differences between the following settings:
SerializerBuilder.addRootType()
- Affects whether SerializerBuilder.addBeanTypes()
- Affects whether
addRootType
in class WriterSerializerBuilder
public RdfSerializerBuilder keepNullProperties()
SerializerBuilder
When enabled, null bean values will be serialized to the output.
keepNullProperties
in class WriterSerializerBuilder
public RdfSerializerBuilder listener(Class<? extends SerializerListener> value)
SerializerBuilder
Class used to listen for errors and warnings that occur during serialization.
listener
in class WriterSerializerBuilder
value
- The new value for this property.public RdfSerializerBuilder sortCollections()
SerializerBuilder
When enabled, copies and sorts the contents of arrays and collections before serializing them.
Note that this introduces a performance penalty since it requires copying the existing collection.
sortCollections
in class WriterSerializerBuilder
public RdfSerializerBuilder sortMaps()
SerializerBuilder
When enabled, copies and sorts the contents of maps by their keys before serializing them.
Note that this introduces a performance penalty.
sortMaps
in class WriterSerializerBuilder
public RdfSerializerBuilder trimEmptyCollections()
SerializerBuilder
When enabled, empty lists and arrays will not be serialized.
Note that enabling this setting has the following effects on parsing:
trimEmptyCollections
in class WriterSerializerBuilder
public RdfSerializerBuilder trimEmptyMaps()
SerializerBuilder
When enabled, empty map values will not be serialized to the output.
Note that enabling this setting has the following effects on parsing:
trimEmptyMaps
in class WriterSerializerBuilder
public RdfSerializerBuilder trimStrings()
SerializerBuilder
When enabled, string values will be trimmed of whitespace using String.trim()
before being serialized.
trimStrings
in class WriterSerializerBuilder
public RdfSerializerBuilder uriContext(UriContext value)
SerializerBuilder
Bean used for resolution of URIs to absolute or root-relative form.
uriContext
in class WriterSerializerBuilder
value
- The new value for this property.public RdfSerializerBuilder uriRelativity(UriRelativity value)
SerializerBuilder
Defines what relative URIs are relative to when serializing any of the following:
Possible values are:
UriRelativity.RESOURCE
- Relative URIs should be considered relative to the servlet URI.
UriRelativity.PATH_INFO
- Relative URIs should be considered relative to the request URI.
See SerializerBuilder.uriContext(UriContext)
for examples.
uriRelativity
in class WriterSerializerBuilder
value
- The new value for this property.
UriRelativity.RESOURCE
public RdfSerializerBuilder uriResolution(UriResolution value)
SerializerBuilder
Defines the resolution level for URIs when serializing any of the following:
Possible values are:
UriResolution.ABSOLUTE
- Resolve to an absolute URL (e.g. UriResolution.ROOT_RELATIVE
- Resolve to a root-relative URL (e.g. UriResolution.NONE
- Don't do any URL resolution.
See SerializerBuilder.uriContext(UriContext)
for examples.
uriResolution
in class WriterSerializerBuilder
value
- The new value for this property.
UriResolution.NONE
public RdfSerializerBuilder fileCharset(Charset value)
WriterSerializerBuilder
The character set to use for writing
Used when passing in files to Serializer.serialize(Object, Object)
.
fileCharset
in class WriterSerializerBuilder
value
- The new value for this property.
public RdfSerializerBuilder maxIndent(int value)
WriterSerializerBuilder
Specifies the maximum indentation level in the serialized document.
maxIndent
in class WriterSerializerBuilder
value
- The new value for this property.
public RdfSerializerBuilder quoteChar(char value)
WriterSerializerBuilder
Specifies the character to use for quoting attributes and values.
quoteChar
in class WriterSerializerBuilder
value
- The new value for this property.
public RdfSerializerBuilder sq()
WriterSerializerBuilder
Specifies to use single quotes for quoting attributes and values.
sq
in class WriterSerializerBuilder
public RdfSerializerBuilder streamCharset(Charset value)
WriterSerializerBuilder
The character set to use when writing to
Used when passing in output streams and byte arrays to Serializer.serialize(Object, Object)
.
streamCharset
in class WriterSerializerBuilder
value
- The new value for this property.
public RdfSerializerBuilder useWhitespace()
WriterSerializerBuilder
When enabled, whitespace is added to the output to improve readability.
useWhitespace
in class WriterSerializerBuilder
public RdfSerializerBuilder ws()
WriterSerializerBuilder
When enabled, whitespace is added to the output to improve readability.
ws
in class WriterSerializerBuilder
Copyright © 2016–2020 The Apache Software Foundation. All rights reserved.