-
- All Known Implementing Classes:
AbstractComponentFactory
,AbstractComponentFactory
public interface ComponentFactory
A provider of component types registered into the system viaComponentFactoryProvider
. The available components in the local system will be a combination of results from all registered component factories.The default
ComponentFactoryService
orRootFactoryService
will create instances of components or roots by calling the factory methodscreateComponent(org.praxislive.core.ComponentType)
orcreateRootComponent(org.praxislive.core.ComponentType)
. As an alternative, redirects can be provided to other services that will be used to construct the requested type. The alternative service might use the factory methods, other data in the component data lookups, or its own registry to construct the component.The data lookups can also be used to provide additional metadata related to each component type.
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static class
ComponentFactory.MetaData<T>
Deprecated.static class
ComponentFactory.Redirect
A factory service redirect.
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Deprecated Methods Modifier and Type Method Description default Lookup
componentData(ComponentType type)
Query the data associated with this component type.default Optional<ComponentFactory.Redirect>
componentRedirect()
Optional service to redirect to for component instantiation.Stream<ComponentType>
componentTypes()
Component types provided by this factory.default Component
createComponent(ComponentType type)
Create an instance of the component associated with this type.default Root
createRoot(ComponentType type)
Create an instance of the root associated with this type.default Root
createRootComponent(ComponentType type)
Deprecated.default Class<? extends ComponentFactoryService>
getFactoryService()
Deprecated.default ComponentFactory.MetaData<? extends Component>
getMetaData(ComponentType type)
Deprecated.default Class<? extends RootFactoryService>
getRootFactoryService()
Deprecated.default ComponentFactory.MetaData<? extends Root>
getRootMetaData(ComponentType type)
Deprecated.default Lookup
rootData(ComponentType type)
Query the data associated with this root type.default Optional<ComponentFactory.Redirect>
rootRedirect()
Optional service to redirect to for root instantiation.Stream<ComponentType>
rootTypes()
Root types provided by this factory.
-
-
-
Method Detail
-
componentTypes
Stream<ComponentType> componentTypes()
Component types provided by this factory.- Returns:
- stream of component types
-
rootTypes
Stream<ComponentType> rootTypes()
Root types provided by this factory.- Returns:
- stream of root types
-
getMetaData
@Deprecated default ComponentFactory.MetaData<? extends Component> getMetaData(ComponentType type)
Deprecated.
-
getRootMetaData
@Deprecated default ComponentFactory.MetaData<? extends Root> getRootMetaData(ComponentType type)
Deprecated.
-
componentData
default Lookup componentData(ComponentType type)
Query the data associated with this component type.- Parameters:
type
- component type- Returns:
- lookup of data
-
rootData
default Lookup rootData(ComponentType type)
Query the data associated with this root type.- Parameters:
type
- root type- Returns:
- lookup of data
-
createComponent
default Component createComponent(ComponentType type) throws ComponentInstantiationException
Create an instance of the component associated with this type. Component factories with a redirect may not support this method, and always throw an exception. The default implementation always throws an exception.- Parameters:
type
- component type to create- Returns:
- created component instance
- Throws:
ComponentInstantiationException
-
createRoot
default Root createRoot(ComponentType type) throws ComponentInstantiationException
Create an instance of the root associated with this type. Component factories with a redirect may not support this method, and always throw an exception. The default implementation always throws an exception.- Parameters:
type
- root type to create- Returns:
- created root instance
- Throws:
ComponentInstantiationException
-
createRootComponent
@Deprecated default Root createRootComponent(ComponentType type) throws ComponentInstantiationException
Deprecated.- Throws:
ComponentInstantiationException
-
getFactoryService
@Deprecated default Class<? extends ComponentFactoryService> getFactoryService()
Deprecated.
-
getRootFactoryService
@Deprecated default Class<? extends RootFactoryService> getRootFactoryService()
Deprecated.
-
componentRedirect
default Optional<ComponentFactory.Redirect> componentRedirect()
Optional service to redirect to for component instantiation. The control on the service should follow the same shape as the defaultComponentFactoryService.NEW_INSTANCE_INFO
, accepting aComponentType
and returning the component instance wrapped in aPReference
.- Returns:
- optional service redirect
-
rootRedirect
default Optional<ComponentFactory.Redirect> rootRedirect()
Optional service to redirect to for root instantiation. The control on the service should follow the same shape as the defaultRootFactoryService.NEW_ROOT_INSTANCE_INFO
, accepting aComponentType
and returning the root instance wrapped in aPReference
.- Returns:
- optional service redirect
-
-