Package org.apache.juneau.uon
Class UonParser
java.lang.Object
org.apache.juneau.Context
org.apache.juneau.BeanContextable
org.apache.juneau.parser.Parser
org.apache.juneau.parser.ReaderParser
org.apache.juneau.uon.UonParser
- All Implemented Interfaces:
AnnotationProvider
,HttpPartParser
,UonMetaProvider
- Direct Known Subclasses:
OpenApiParser
,UonParser.Decoding
,UrlEncodingParser
Parses UON (a notation for URL-encoded query parameter values) text into POJO models.
Media types
Handles
Description
This parser uses a state machine, which makes it very fast and efficient.
Notes:
- This class is thread safe and reusable.
See Also:
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
Builder class.static class
Default parser, decoding.Nested classes/interfaces inherited from class org.apache.juneau.parser.Parser
Parser.Null
Nested classes/interfaces inherited from interface org.apache.juneau.httppart.HttpPartParser
HttpPartParser.Creator, HttpPartParser.Void
-
Field Summary
Modifier and TypeFieldDescriptionstatic final UonParser
Reusable instance ofUonParser
, all default settings.static final UonParser
Reusable instance ofUonParser
with decodeChars set to true.Fields inherited from class org.apache.juneau.Context
CONTEXT_APPLY_FILTER
Fields inherited from interface org.apache.juneau.AnnotationProvider
DISABLE_ANNOTATION_CACHING
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptioncopy()
Creates a builder from this context object.static UonParser.Builder
create()
Creates a new builder for this object.Create a session builder based on the properties defined on this context.<T> ClassMeta<T>
getClassMeta
(Class<T> c) Returns metadata about the specified class.<T> ClassMeta<T>
getClassMeta
(Type t, Type... args) Returns metadata about the specified class.Creates a new parser session.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 boolean
Decode"%xx" sequences enabledprotected final boolean
Validate end enabled.<T> T
parse
(HttpPartType partType, HttpPartSchema schema, String in, Class<T> toType) Converts the specified input to the specified class type.<T> T
parse
(HttpPartType partType, HttpPartSchema schema, String in, Type toType, Type... toTypeArgs) Converts the specified input to the specified class type.<T> T
parse
(HttpPartType partType, HttpPartSchema schema, String in, ClassMeta<T> toType) Converts the specified input to the specified class type.protected JsonMap
Returns the properties on this bean as a map for debugging.Methods inherited from class org.apache.juneau.parser.ReaderParser
getFileCharset, getStreamCharset, isReaderParser
Methods inherited from class org.apache.juneau.parser.Parser
canHandle, createParserBuilder, doParse, getDebugOutputLines, getListener, getMediaTypes, getPrimaryMediaType, isAutoCloseStreams, isStrict, isTrimStrings, isUnbuffered, parse, parse, parse, parse, parse, parse, parseArgs, parseIntoCollection, parseIntoMap
Methods inherited from class org.apache.juneau.BeanContextable
getBeanContext
Methods inherited from class org.apache.juneau.Context
createBuilder, firstAnnotation, firstAnnotation, firstAnnotation, firstAnnotation, firstDeclaredAnnotation, forEachAnnotation, forEachAnnotation, forEachAnnotation, forEachAnnotation, forEachDeclaredAnnotation, hasAnnotation, hasAnnotation, hasAnnotation, hasAnnotation, init, isDebug, lastAnnotation, lastAnnotation, lastAnnotation, lastAnnotation, lastDeclaredAnnotation, toString
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.apache.juneau.AnnotationProvider
firstAnnotation, firstAnnotation, firstAnnotation, firstAnnotation, firstDeclaredAnnotation, forEachAnnotation, forEachAnnotation, forEachAnnotation, forEachAnnotation, forEachDeclaredAnnotation, lastAnnotation, lastAnnotation, lastAnnotation, lastAnnotation, lastDeclaredAnnotation
-
Field Details
-
Constructor Details
-
UonParser
Constructor.- Parameters:
builder
- The builder for this object.
-
-
Method Details
-
create
Creates a new builder for this object.- Returns:
- A new builder.
-
copy
Description copied from class:Context
Creates a builder from this context object.Builders are used to define new contexts (e.g. serializers, parsers) based on existing configurations.
-
createSession
Description copied from class:Context
Create 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:
createSession
in classReaderParser
- Returns:
- A new session builder.
-
getSession
Description copied from class:Context
Returns a session to use for this context.Note that subclasses may opt to return a reusable non-modifiable session.
- Overrides:
getSession
in classReaderParser
- Returns:
- A new session object.
-
getPartSession
Description copied from interface:HttpPartParser
Creates a new parser session.- Specified by:
getPartSession
in interfaceHttpPartParser
- Returns:
- A new parser session.
-
parse
public <T> T parse(HttpPartType partType, HttpPartSchema schema, String in, ClassMeta<T> toType) throws ParseException, SchemaValidationException Converts the specified input to the specified class type.- Type Parameters:
T
- The POJO type to transform the input into.- Parameters:
partType
- The part type being parsed.schema
- Schema information about the part.
May benull .
Not all part parsers use the schema information.in
- The input being parsed.toType
- The POJO type to transform the input into.- Returns:
- The parsed value.
- Throws:
ParseException
- Malformed input encountered.SchemaValidationException
- If the input or resulting HTTP part object fails schema validation.
-
parse
public <T> T parse(HttpPartType partType, HttpPartSchema schema, String in, Class<T> toType) throws ParseException, SchemaValidationException Converts the specified input to the specified class type.- Type Parameters:
T
- The POJO type to transform the input into.- Parameters:
partType
- The part type being parsed.schema
- Schema information about the part.
May benull .
Not all part parsers use the schema information.in
- The input being parsed.toType
- The POJO type to transform the input into.- Returns:
- The parsed value.
- Throws:
ParseException
- Malformed input encountered.SchemaValidationException
- If the input or resulting HTTP part object fails schema validation.
-
parse
public <T> T parse(HttpPartType partType, HttpPartSchema schema, String in, Type toType, Type... toTypeArgs) throws ParseException, SchemaValidationException Converts the specified input to the specified class type.- Type Parameters:
T
- The POJO type to transform the input into.- Parameters:
partType
- The part type being parsed.schema
- Schema information about the part.
May benull .
Not all part parsers use the schema information.in
- The input being parsed.toType
- The POJO type to transform the input into.toTypeArgs
- The generic type arguments of the POJO type to transform the input into.- Returns:
- The parsed value.
- Throws:
ParseException
- Malformed input encountered.SchemaValidationException
- If the input or resulting HTTP part object fails schema validation.
-
getUonClassMeta
Description copied from interface:UonMetaProvider
Returns the language-specific metadata on the specified class.- Specified by:
getUonClassMeta
in interfaceUonMetaProvider
- Parameters:
cm
- The class to return the metadata on.- Returns:
- The metadata.
-
getUonBeanPropertyMeta
Description copied from interface:UonMetaProvider
Returns the language-specific metadata on the specified bean property.- Specified by:
getUonBeanPropertyMeta
in interfaceUonMetaProvider
- Parameters:
bpm
- The bean property to return the metadata on.- Returns:
- The metadata.
-
isDecoding
Decode"%xx" sequences enabled- Returns:
true if URI encoded characters should be decoded,false if they've already been decoded before being passed to this parser.- See Also:
-
isValidateEnd
Validate end enabled.- Returns:
true if after parsing a POJO from the input, verifies that the remaining input in the stream consists of only comments or whitespace.- See Also:
-
getClassMeta
Description copied from interface:HttpPartParser
Returns metadata about the specified class.- Specified by:
getClassMeta
in interfaceHttpPartParser
- Type Parameters:
T
- The class type.- Parameters:
c
- The class type.- Returns:
- Metadata about the specified class.
-
getClassMeta
Description copied from interface:HttpPartParser
Returns metadata about the specified class.- Specified by:
getClassMeta
in interfaceHttpPartParser
- Type Parameters:
T
- The class type.- Parameters:
t
- The class type.args
- The class type args.- Returns:
- Metadata about the specified class.
-
properties
Description copied from class:Context
Returns the properties on this bean as a map for debugging.- Overrides:
properties
in classReaderParser
- Returns:
- The properties on this bean as a map for debugging.
-