Class BaseHttpPartParser

All Implemented Interfaces:
AnnotationProvider, HttpPartParser
Direct Known Subclasses:
SimplePartParser

public abstract class BaseHttpPartParser extends BeanContextable implements HttpPartParser
Base class for implementations of HttpPartParser
Notes:
  • This class is thread safe and reusable.
See Also:
  • Constructor Details

  • Method Details

    • 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 be null.
      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 be null.
      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 be null.
      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.
    • getClassMeta

      public <T> ClassMeta<T> getClassMeta(Class<T> c)
      Description copied from interface: HttpPartParser
      Returns metadata about the specified class.
      Specified by:
      getClassMeta in interface HttpPartParser
      Type Parameters:
      T - The class type.
      Parameters:
      c - The class type.
      Returns:
      Metadata about the specified class.
    • getClassMeta

      public <T> ClassMeta<T> getClassMeta(Type t, Type... args)
      Description copied from interface: HttpPartParser
      Returns metadata about the specified class.
      Specified by:
      getClassMeta in interface HttpPartParser
      Type Parameters:
      T - The class type.
      Parameters:
      t - The class type.
      args - The class type args.
      Returns:
      Metadata about the specified class.