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:
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
Nested ClassesModifier and TypeClassDescriptionstatic classBuilder class.static classDefault parser, decoding.Nested classes/interfaces inherited from class org.apache.juneau.parser.Parser
Parser.NullNested classes/interfaces inherited from interface org.apache.juneau.httppart.HttpPartParser
HttpPartParser.Creator, HttpPartParser.Void -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final booleanstatic final UonParserReusable instance ofUonParser, all default settings.static final UonParserReusable instance ofUonParserwith decodeChars set to true.protected final booleanFields inherited from class org.apache.juneau.parser.Parser
autoCloseStreams, consumes, debugOutputLines, listener, strict, trimStrings, unbufferedFields inherited from class org.apache.juneau.BeanContextable
beanContextFields inherited from class org.apache.juneau.Context
CONTEXT_APPLY_FILTER -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncopy()Creates a builder from this context object.static UonParser.Buildercreate()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 booleanDecode"%xx" sequences enabledprotected final booleanValidate end enabled.<T> Tparse(HttpPartType partType, HttpPartSchema schema, String in, Class<T> toType) Converts the specified input to the specified class type.<T> Tparse(HttpPartType partType, HttpPartSchema schema, String in, Type toType, Type... toTypeArgs) Converts the specified input to the specified class type.<T> Tparse(HttpPartType partType, HttpPartSchema schema, String in, ClassMeta<T> toType) Converts the specified input to the specified class type.Returns the properties on this bean as a map for debugging.Methods inherited from class org.apache.juneau.parser.ReaderParser
getFileCharset, getStreamCharset, isReaderParserMethods 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, parseIntoMapMethods inherited from class org.apache.juneau.BeanContextable
getBeanContextMethods inherited from class org.apache.juneau.Context
createBuilder, getAnnotationProvider, init, isDebug, toString
-
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:ContextCreates 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: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 classReaderParser- Returns:
- A new session builder.
-
getClassMeta
Description copied from interface:HttpPartParserReturns metadata about the specified class.- Specified by:
getClassMetain interfaceHttpPartParser- Type Parameters:
T- The class type.- Parameters:
c- The class type.- Returns:
- Metadata about the specified class.
-
getClassMeta
Description copied from interface:HttpPartParserReturns metadata about the specified class.- Specified by:
getClassMetain interfaceHttpPartParser- Type Parameters:
T- The class type.- Parameters:
t- The class type.args- The class type args.- Returns:
- Metadata about the specified class.
-
getPartSession
Description copied from interface:HttpPartParserCreates a new parser session.- Specified by:
getPartSessionin interfaceHttpPartParser- Returns:
- A new parser session.
-
getSession
Description 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 classReaderParser- Returns:
- A new session object.
-
getUonBeanPropertyMeta
Description copied from interface:UonMetaProviderReturns the language-specific metadata on the specified bean property.- Specified by:
getUonBeanPropertyMetain interfaceUonMetaProvider- Parameters:
bpm- The bean property to return the metadata on.- Returns:
- The metadata.
-
getUonClassMeta
Description copied from interface:UonMetaProviderReturns the language-specific metadata on the specified class.- Specified by:
getUonClassMetain interfaceUonMetaProvider- Parameters:
cm- The class to return the metadata on.- Returns:
- The metadata.
-
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, 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, 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.
-
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:
-
properties
Description copied from class:ContextReturns the properties on this bean as a map for debugging.- Overrides:
propertiesin classReaderParser- Returns:
- The properties on this bean as a map for debugging.
-