Interface ObjectFactory<T>

Type Parameters:
T - the type of the object to be created. The type parameter will be used to find out if the object implements interfaces related to mule like lifecycle interfaces. If the type could not be known in advance and can only be know at runtime then implement ObjectTypeProvider to inform the actual type.
All Superinterfaces:
org.mule.runtime.api.component.Component
All Known Subinterfaces:
ComponentFactory<T>
All Known Implementing Classes:
AbstractComponentFactory

public interface ObjectFactory<T> extends org.mule.runtime.api.component.Component
Interface that must be implemented by those classes that are meant to be used as a factory to create complex domain objects. This object may have a complex construction with setters and constructor parameters which are going to be defined by the ComponentBuildingDefinition that use them.

Implementations of ObjectFactory can be annotated with @Inject at the field level to get dependency injection that can later be used for the purpose of creating the object with getObject method. Objects created with the ObjectFactory will not have dependency injection support.

ObjectFactories do not support any lifecycle method but the object created through getObject may implement lifecycle interfaces.

Since:
4.0
  • Nested Class Summary

    Nested classes/interfaces inherited from interface org.mule.runtime.api.component.Component

    org.mule.runtime.api.component.Component.Annotations
  • Field Summary

    Fields inherited from interface org.mule.runtime.api.component.Component

    ANNOTATIONS_PROPERTY_NAME, NS_MULE_DOCUMENTATION, NS_MULE_PARSER_METADATA
  • Method Summary

    Modifier and Type
    Method
    Description
     

    Methods inherited from interface org.mule.runtime.api.component.Component

    getAnnotation, getAnnotations, getDslSource, getIdentifier, getLocation, getRepresentation, getRootContainerLocation, setAnnotations
  • Method Details

    • getObject

      T getObject() throws Exception
      Returns:
      the created object
      Throws:
      Exception - any failure that may occur building the object