Class ObjectFactory<B>

java.lang.Object
org.exoplatform.commons.serialization.api.factory.ObjectFactory<B>
Direct Known Subclasses:
DefaultObjectFactory

public abstract class ObjectFactory<B> extends Object
A factory that creates instance of a type.
  • Constructor Details

    • ObjectFactory

      public ObjectFactory()
  • Method Details

    • create

      public abstract <S extends B> S create(Class<S> type, Map<FieldModel<? super S,?>,?> state) throws CreateException
      Instantiate an object based on the provided type. The implementor should take care of configuring the state of the returned objet with the provided state map argument.
      Type Parameters:
      S - the parameter type of the sub type of the base type
      Parameters:
      type - the type
      state - the state
      Returns:
      the S instance
      Throws:
      CreateException - anything wrong that happened during instance creation