Class UonSerializer
- All Implemented Interfaces:
- AnnotationProvider,- HttpPartSerializer,- UonMetaProvider
- Direct Known Subclasses:
- OpenApiSerializer,- UonSerializer.Encoding,- UonSerializer.Readable,- UrlEncodingSerializer
Media types
 Handles 
 Produces 
Description
This serializer provides several serialization options. Typically, one of the predefined DEFAULT serializers will be sufficient. However, custom serializers can be constructed to fine-tune behavior.
The following shows a sample object defined in Javascript:
   {
      id: 1,
      name: 
Using the "strict" syntax defined in this document, the equivalent UON notation would be as follows:
   (
      
Example:
   
Notes:
- This class is thread safe and reusable.
See Also:
- 
Nested Class SummaryNested ClassesModifier and TypeClassDescriptionstatic classBuilder class.static classEquivalent toUonSerializer..create ().encoding().build();static classEquivalent toUonSerializer..create ().ws().build();Nested classes/interfaces inherited from class org.apache.juneau.serializer.SerializerSerializer.NullNested classes/interfaces inherited from interface org.apache.juneau.httppart.HttpPartSerializerHttpPartSerializer.Creator, HttpPartSerializer.Void
- 
Field SummaryFieldsModifier and TypeFieldDescriptionstatic final UonSerializerReusable instance ofUonSerializer, all default settings.static final UonSerializerReusable instance ofUonSerializer.Encoding.static final UonSerializerReusable instance ofUonSerializer.Readable.Fields inherited from class org.apache.juneau.ContextCONTEXT_APPLY_FILTERFields inherited from interface org.apache.juneau.AnnotationProviderDISABLE_ANNOTATION_CACHING
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptioncopy()Creates a builder from this context object.static UonSerializer.Buildercreate()Creates a new builder for this object.Create a session builder based on the properties defined on this context.protected final ParamFormatFormat to use for query/form-data/header values.Creates a new serializer session.protected final charQuote character.Returns a session to use for this context.Returns the language-specific metadata on the specified bean property.getUonClassMeta(ClassMeta<?> cm) Returns the language-specific metadata on the specified class.protected final booleanAdd"_type" properties when needed.protected final booleanEncode non-valid URI characters.protected JsonMapReturns the properties on this bean as a map for debugging.serialize(HttpPartType partType, HttpPartSchema schema, Object value) Converts the specified value to a string that can be used as an HTTP header value, query parameter value, form-data parameter, or URI path variable.Methods inherited from class org.apache.juneau.serializer.WriterSerializergetFileCharset, getMaxIndent, getStreamCharset, isUseWhitespace, isWriterSerializer, println, quoteChar, serialize, toStringMethods inherited from class org.apache.juneau.serializer.SerializercreateSerializerBuilder, doSerialize, forEachAcceptMediaType, getListener, getMediaTypeRanges, getPrimaryMediaType, getResponseContentType, getResponseHeaders, getUriContext, getUriRelativity, getUriResolution, isAddRootType, isKeepNullProperties, isSortCollections, isSortMaps, isTrimEmptyCollections, isTrimEmptyMaps, isTrimStrings, serialize, serializeToStringMethods inherited from class org.apache.juneau.BeanTraverseContextgetInitialDepth, getMaxDepth, isDetectRecursions, isIgnoreRecursionsMethods inherited from class org.apache.juneau.BeanContextablegetBeanContextMethods inherited from class org.apache.juneau.ContextcreateBuilder, firstAnnotation, firstAnnotation, firstAnnotation, firstAnnotation, firstDeclaredAnnotation, forEachAnnotation, forEachAnnotation, forEachAnnotation, forEachAnnotation, forEachDeclaredAnnotation, hasAnnotation, hasAnnotation, hasAnnotation, hasAnnotation, init, isDebug, lastAnnotation, lastAnnotation, lastAnnotation, lastAnnotation, lastDeclaredAnnotation, toStringMethods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.apache.juneau.AnnotationProviderfirstAnnotation, firstAnnotation, firstAnnotation, firstAnnotation, firstDeclaredAnnotation, forEachAnnotation, forEachAnnotation, forEachAnnotation, forEachAnnotation, forEachDeclaredAnnotation, lastAnnotation, lastAnnotation, lastAnnotation, lastAnnotation, lastDeclaredAnnotation
- 
Field Details- 
DEFAULTReusable instance ofUonSerializer, all default settings.
- 
DEFAULT_READABLEReusable instance ofUonSerializer.Readable.
- 
DEFAULT_ENCODINGReusable instance ofUonSerializer.Encoding.
 
- 
- 
Constructor Details- 
UonSerializerConstructor.- Parameters:
- builder- The builder for this object.
 
 
- 
- 
Method Details- 
createCreates a new builder for this object.- Returns:
- A new builder.
 
- 
serializepublic String serialize(HttpPartType partType, HttpPartSchema schema, Object value) throws SchemaValidationException, SerializeException Converts the specified value to a string that can be used as an HTTP header value, query parameter value, form-data parameter, or URI path variable.Returned values should NOT be URL-encoded. - Parameters:
- partType- The category of value being serialized.
- schema- Schema information about the part.
 May be- null .
 Not all part serializers use the schema information.
- value- The value being serialized.
- Returns:
- The serialized value.
- Throws:
- SerializeException- If a problem occurred while trying to parse the input.
- SchemaValidationException- If the output fails schema validation.
 
- 
copyDescription copied from class:ContextCreates a builder from this context object.Builders are used to define new contexts (e.g. serializers, parsers) based on existing configurations. - Overrides:
- copyin class- WriterSerializer
- Returns:
- A new Builder object.
 
- 
createSessionDescription copied from class:ContextCreate a session builder based on the properties defined on this context.Use this method for creating sessions where you want to override basic settings. Otherwise, use Context.getSession()directly.- Overrides:
- createSessionin class- WriterSerializer
- Returns:
- A new session builder.
 
- 
getSessionDescription copied from class:ContextReturns a session to use for this context.Note that subclasses may opt to return a reusable non-modifiable session. - Overrides:
- getSessionin class- WriterSerializer
- Returns:
- A new session object.
 
- 
getPartSessionDescription copied from interface:HttpPartSerializerCreates a new serializer session.- Specified by:
- getPartSessionin interface- HttpPartSerializer
- Returns:
- A new serializer session.
 
- 
getUonClassMetaDescription copied from interface:UonMetaProviderReturns the language-specific metadata on the specified class.- Specified by:
- getUonClassMetain interface- UonMetaProvider
- Parameters:
- cm- The class to return the metadata on.
- Returns:
- The metadata.
 
- 
getUonBeanPropertyMetaDescription copied from interface:UonMetaProviderReturns the language-specific metadata on the specified bean property.- Specified by:
- getUonBeanPropertyMetain interface- UonMetaProvider
- Parameters:
- bpm- The bean property to return the metadata on.
- Returns:
- The metadata.
 
- 
isAddBeanTypesAdd"_type" properties when needed.- Overrides:
- isAddBeanTypesin class- Serializer
- Returns:
- true if- "_type" properties will be added to beans if their type cannot be inferred through reflection.
- See Also:
 
- 
isEncodingEncode non-valid URI characters.- Returns:
- true if non-valid URI characters should be encoded with- "%xx" constructs.
- See Also:
 
- 
getParamFormatFormat to use for query/form-data/header values.- Returns:
- Specifies the format to use for URL GET parameter keys and values.
- See Also:
 
- 
getQuoteCharQuote character.- Overrides:
- getQuoteCharin class- WriterSerializer
- Returns:
- The character used for quoting attributes and values.
- See Also:
 
- 
propertiesDescription copied from class:ContextReturns the properties on this bean as a map for debugging.- Overrides:
- propertiesin class- WriterSerializer
- Returns:
- The properties on this bean as a map for debugging.
 
 
-