- All Known Implementing Classes:
AbstractComponentFactory,AbstractComponentFactory
public interface ComponentFactory
A provider of component types registered into the system via
ComponentFactoryProvider. The available components in the local
system will be a combination of results from all registered component
factories.
The default ComponentFactoryService or RootFactoryService
will create instances of components or roots by calling the factory methods
createComponent(org.praxislive.core.ComponentType) or
. 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.
invalid reference
#createRootComponent(org.praxislive.core.ComponentType)
The data lookups can also be used to provide additional metadata related to each component type.
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic final recordMark a component deprecated (with optional replacement type).static final recordA factory service redirect. -
Method Summary
Modifier and TypeMethodDescriptiondefault LookupcomponentData(ComponentType type) Query the data associated with this component type.default Optional<ComponentFactory.Redirect> Optional service to redirect to for component instantiation.Component types provided by this factory.default ComponentcreateComponent(ComponentType type) Create an instance of the component associated with this type.default RootcreateRoot(ComponentType type) Create an instance of the root associated with this type.default LookuprootData(ComponentType type) Query the data associated with this root type.default Optional<ComponentFactory.Redirect> Optional service to redirect to for root instantiation.Root types provided by this factory.
-
Method Details
-
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
-
componentData
Query the data associated with this component type.- Parameters:
type- component type- Returns:
- lookup of data
-
rootData
Query the data associated with this root type.- Parameters:
type- root type- Returns:
- lookup of data
-
createComponent
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
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
-
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 aComponentTypeand returning the component instance wrapped in aPReference.- Returns:
- optional service 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 aComponentTypeand returning the root instance wrapped in aPReference.- Returns:
- optional service redirect
-