@ConfigurableContext(nocache=true) public final class SerializerGroup extends BeanTraverseContext
Serializers
that can be looked up by media type.
Adding new entries will cause the entries to be prepended to the group. This allows for previous serializers to be overridden through subsequent calls.
For example, calling g.append(S1.
will result in the order
Modifier and Type | Field and Description |
---|---|
static SerializerGroup |
EMPTY
An unmodifiable empty serializer group.
|
BEANTRAVERSE_detectRecursions, BEANTRAVERSE_ignoreRecursions, BEANTRAVERSE_initialDepth, BEANTRAVERSE_maxDepth
BEAN_beanClassVisibility, BEAN_beanConstructorVisibility, BEAN_beanDictionary, BEAN_beanDictionary_add, BEAN_beanDictionary_remove, BEAN_beanFieldVisibility, BEAN_beanFilters, BEAN_beanFilters_add, BEAN_beanFilters_remove, BEAN_beanMapPutReturnsOldValue, BEAN_beanMethodVisibility, BEAN_beansRequireDefaultConstructor, BEAN_beansRequireSerializable, BEAN_beansRequireSettersForGetters, BEAN_beansRequireSomeProperties, BEAN_beanTypePropertyName, BEAN_debug, BEAN_examples, BEAN_excludeProperties, BEAN_fluentSetters, BEAN_ignoreInvocationExceptionsOnGetters, BEAN_ignoreInvocationExceptionsOnSetters, BEAN_ignorePropertiesWithoutSetters, BEAN_ignoreUnknownBeanProperties, BEAN_ignoreUnknownNullBeanProperties, BEAN_implClasses, BEAN_includeProperties, BEAN_locale, BEAN_mediaType, BEAN_notBeanClasses, BEAN_notBeanClasses_add, BEAN_notBeanClasses_remove, BEAN_notBeanPackages, BEAN_notBeanPackages_add, BEAN_notBeanPackages_remove, BEAN_pojoSwaps, BEAN_pojoSwaps_add, BEAN_pojoSwaps_remove, BEAN_propertyNamer, BEAN_sortProperties, BEAN_timeZone, BEAN_useEnumNames, BEAN_useInterfaceProxies, BEAN_useJavaBeanIntrospector, DEFAULT, DEFAULT_SORTED
Constructor and Description |
---|
SerializerGroup(PropertyStore ps,
Serializer[] serializers)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
SerializerGroupBuilder |
builder()
Returns a builder that's a copy of the settings on this serializer group.
|
static SerializerGroupBuilder |
create()
Instantiates a new clean-slate
SerializerGroupBuilder object. |
Serializer |
getSerializer(MediaType mediaType)
Same as
getSerializerMatch(MediaType) but returns just the matched serializer. |
Serializer |
getSerializer(String acceptHeader)
Same as
getSerializerMatch(String) but returns just the matched serializer. |
SerializerMatch |
getSerializerMatch(MediaType mediaType)
Same as
getSerializerMatch(String) but matches using a MediaType instance. |
SerializerMatch |
getSerializerMatch(String acceptHeader)
Searches the group for a serializer that can handle the specified
|
List<Serializer> |
getSerializers()
Returns a copy of the serializers in this group.
|
OutputStreamSerializer |
getStreamSerializer(MediaType mediaType)
Same as
getSerializer(MediaType) , but casts it to a OutputStreamSerializer . |
OutputStreamSerializer |
getStreamSerializer(String acceptHeader)
Same as
getSerializer(String) , but casts it to an OutputStreamSerializer . |
List<MediaType> |
getSupportedMediaTypes()
Returns the media types that all serializers in this group can handle.
|
WriterSerializer |
getWriterSerializer(MediaType mediaType)
Same as
getSerializer(MediaType) , but casts it to a WriterSerializer . |
WriterSerializer |
getWriterSerializer(String acceptHeader)
Same as
getSerializer(String) , but casts it to a WriterSerializer . |
createSession, createSession, getInitialDepth, getMaxDepth, isDetectRecursions, isIgnoreRecursions, toMap
_class, createBeanSession, createBeanSession, createDefaultBeanSessionArgs, createDefaultSessionArgs, createSession, dumpCacheStats, getBeanClassVisibility, getBeanConstructorVisibility, getBeanDictionaryClasses, getBeanFieldVisibility, getBeanFilters, getBeanMeta, getBeanMethodVisibility, getBeanRegistry, getBeanTypePropertyName, getClassMeta, getClassMeta, getClassMetaForObject, getExamples, getExcludeProperties, getExcludeProperties, getImplClassConstructor, getImplClasses, getIncludeProperties, getIncludeProperties, getLocale, getMediaType, getNotBeanClasses, getNotBeanPackagesNames, getNotBeanPackagesPrefixes, getPojoSwaps, getPropertyNamer, getTimeZone, hasSameCache, isBean, isBeanMapPutReturnsOldValue, isBeansRequireDefaultConstructor, isBeansRequireSerializable, isBeansRequireSettersForGetters, isBeansRequireSomeProperties, isDebug, isFluentSetters, isIgnoreInvocationExceptionsOnGetters, isIgnoreInvocationExceptionsOnSetters, isIgnorePropertiesWithoutSetters, isIgnoreUnknownBeanProperties, isIgnoreUnknownNullBeanProperties, isNotABean, isSortProperties, isUseEnumNames, isUseInterfaceProxies, isUseJavaBeanIntrospector, object, resolveClassMeta, string
equals, getArrayProperty, getArrayProperty, getBooleanProperty, getCdlProperty, getClassArrayProperty, getClassArrayProperty, getClassArrayProperty, getClassListProperty, getClassListProperty, getClassMapProperty, getClassMapProperty, getClassProperty, getClassSetProperty, getClassSetProperty, getInstanceArrayProperty, getInstanceArrayProperty, getInstanceArrayProperty, getInstanceProperty, getInstanceProperty, getInstanceProperty, getIntegerProperty, getListProperty, getListProperty, getLongProperty, getMapProperty, getProperty, getProperty, getPropertyKeys, getPropertyStore, getSetProperty, getSetProperty, getStringProperty, getStringPropertyWithNone, hashCode, identityCode, toString
public static final SerializerGroup EMPTY
public SerializerGroup(PropertyStore ps, Serializer[] serializers)
ps
- The modifiable properties that were used to initialize the serializers.
A snapshot of these will be made so that we can clone and modify this group.serializers
- The serializers defined in this group.
The order is important because they will be tried in reverse order (e.g.newer first) in which they will be tried
to match against media types.public static SerializerGroupBuilder create()
SerializerGroupBuilder
object.
This is equivalent to simply calling
.
SerializerGroupBuilder
object.public SerializerGroupBuilder builder()
builder
in class BeanTraverseContext
SerializerGroupBuilder
initialized to this group.public SerializerMatch getSerializerMatch(String acceptHeader)
The
Accept = "Accept" ":" #( media-range [ accept-params ] ) media-range = ( "*\/*" | ( type "/" "*" ) | ( type "/" subtype ) ) *( ";" parameter ) accept-params = ";" "q" "=" qvalue *( accept-extension ) accept-extension = ";" token [ "=" ( token | quoted-string ) ]
The returned object includes both the serializer and media type that matched.
acceptHeader
- The HTTP public SerializerMatch getSerializerMatch(MediaType mediaType)
getSerializerMatch(String)
but matches using a MediaType
instance.mediaType
- The HTTP media type.public Serializer getSerializer(String acceptHeader)
getSerializerMatch(String)
but returns just the matched serializer.acceptHeader
- The HTTP public Serializer getSerializer(MediaType mediaType)
getSerializerMatch(MediaType)
but returns just the matched serializer.mediaType
- The HTTP media type.public WriterSerializer getWriterSerializer(String acceptHeader)
getSerializer(String)
, but casts it to a WriterSerializer
.acceptHeader
- The HTTP public WriterSerializer getWriterSerializer(MediaType mediaType)
getSerializer(MediaType)
, but casts it to a WriterSerializer
.mediaType
- The HTTP media type.public OutputStreamSerializer getStreamSerializer(String acceptHeader)
getSerializer(String)
, but casts it to an OutputStreamSerializer
.acceptHeader
- The HTTP public OutputStreamSerializer getStreamSerializer(MediaType mediaType)
getSerializer(MediaType)
, but casts it to a OutputStreamSerializer
.mediaType
- The HTTP media type.public List<MediaType> getSupportedMediaTypes()
Entries are ordered in the same order as the serializers in the group.
public List<Serializer> getSerializers()
Copyright © 2016–2019 The Apache Software Foundation. All rights reserved.