Class BaseTypeProducer

java.lang.Object
org.exoplatform.services.rest.impl.method.BaseTypeProducer
All Implemented Interfaces:
TypeProducer
Direct Known Subclasses:
PrimitiveTypeProducer, StringConstructorProducer, StringProducer, StringValueOfProducer

public abstract class BaseTypeProducer extends Object implements TypeProducer
Abstraction for single (not for collections) types.
Version:
$Id: $
Author:
Andrey Parfonov
  • Constructor Details

    • BaseTypeProducer

      public BaseTypeProducer()
  • Method Details

    • createValue

      protected abstract Object createValue(String value) throws Exception
      Create object from given string. In all extends for this class this method must be specified to produce object of required type. String will be used as parameter for constructor of object or static valueOf method.
      Parameters:
      value - string value
      Returns:
      newly created object
      Throws:
      Exception - if any error occurs
    • createValue

      public Object createValue(String param, javax.ws.rs.core.MultivaluedMap<String,String> values, String defaultValue) throws Exception
      Specified by:
      createValue in interface TypeProducer
      Parameters:
      param - parameter name, parameter name should be getting from parameter annotation
      values - all value which can be used for construct object, it can be header parameters, path parameters, query parameters, etc
      defaultValue - default value which can be used if in value can't be found required value with name param
      Returns:
      newly created object
      Throws:
      Exception - if any errors occurs