Package org.apache.juneau.httppart
Class BaseHttpPartParser
java.lang.Object
org.apache.juneau.Context
org.apache.juneau.BeanContextable
org.apache.juneau.httppart.BaseHttpPartParser
- All Implemented Interfaces:
HttpPartParser
- Direct Known Subclasses:
SimplePartParser
Base class for implementations of
HttpPartParser
Notes:
- This class is thread safe and reusable.
See Also:
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from interface org.apache.juneau.httppart.HttpPartParser
HttpPartParser.Creator, HttpPartParser.Void -
Field Summary
Fields inherited from class org.apache.juneau.BeanContextable
beanContextFields inherited from class org.apache.juneau.Context
CONTEXT_APPLY_FILTER -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedConstructor. -
Method Summary
Modifier and TypeMethodDescription<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.<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.Methods inherited from class org.apache.juneau.BeanContextable
getBeanContext, propertiesMethods inherited from class org.apache.juneau.Context
copy, createBuilder, createSession, getAnnotationProvider, getSession, init, isDebug, toStringMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.apache.juneau.httppart.HttpPartParser
getPartSession
-
Constructor Details
-
BaseHttpPartParser
Constructor.- Parameters:
builder- The builder for this object.
-
-
Method Details
-
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.
-
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.
Can benull (will default toHttpPartType.OTHER).schema- Schema information about the part.
Can benull .
Not all part parsers use the schema information.in- The input being parsed.
Can benull (will returnnull or use schema default if available).toType- The POJO type to transform the input into.
Cannot benull .- 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.
Can benull (will default toHttpPartType.OTHER).schema- Schema information about the part.
Can benull .
Not all part parsers use the schema information.in- The input being parsed.
Can benull (will returnnull or use schema default if available).toType- The POJO type to transform the input into.
Cannot benull .- 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.
Can benull (will default toHttpPartType.OTHER).schema- Schema information about the part.
Can benull .
Not all part parsers use the schema information.in- The input being parsed.
Can benull (will returnnull or use schema default if available).toType- The POJO type to transform the input into.
Cannot benull .toTypeArgs- The generic type arguments of the POJO type to transform the input into.
Cannot containnull values.- Returns:
- The parsed value.
- Throws:
ParseException- Malformed input encountered.SchemaValidationException- If the input or resulting HTTP part object fails schema validation.
-