- java.lang.Object
-
- org.praxislive.base.AbstractComponentFactory
-
- All Implemented Interfaces:
ComponentFactory
public class AbstractComponentFactory extends Object implements ComponentFactory
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
AbstractComponentFactory.Data<T>
-
Nested classes/interfaces inherited from interface org.praxislive.core.services.ComponentFactory
ComponentFactory.MetaData<T>, ComponentFactory.Redirect
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
AbstractComponentFactory()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
add(String type, Class<? extends Component> cls)
protected void
add(String type, AbstractComponentFactory.Data<? extends Component> info)
protected void
addRoot(String type, Class<? extends Root> cls)
protected void
addRoot(String type, AbstractComponentFactory.Data<? extends Root> info)
Stream<ComponentType>
componentTypes()
Component types provided by this factory.Component
createComponent(ComponentType type)
Create an instance of the component associated with this type.Root
createRootComponent(ComponentType type)
static <T> AbstractComponentFactory.Data<T>
data(Class<T> cls)
ComponentFactory.MetaData<? extends Component>
getMetaData(ComponentType type)
ComponentFactory.MetaData<? extends Root>
getRootMetaData(ComponentType type)
Stream<ComponentType>
rootTypes()
Root types provided by this factory.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.praxislive.core.services.ComponentFactory
componentData, componentRedirect, createRoot, getFactoryService, getRootFactoryService, rootData, rootRedirect
-
-
-
-
Method Detail
-
componentTypes
public Stream<ComponentType> componentTypes()
Description copied from interface:ComponentFactory
Component types provided by this factory.- Specified by:
componentTypes
in interfaceComponentFactory
- Returns:
- stream of component types
-
rootTypes
public Stream<ComponentType> rootTypes()
Description copied from interface:ComponentFactory
Root types provided by this factory.- Specified by:
rootTypes
in interfaceComponentFactory
- Returns:
- stream of root types
-
createComponent
public Component createComponent(ComponentType type) throws ComponentInstantiationException
Description copied from interface:ComponentFactory
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.- Specified by:
createComponent
in interfaceComponentFactory
- Parameters:
type
- component type to create- Returns:
- created component instance
- Throws:
ComponentInstantiationException
-
createRootComponent
public Root createRootComponent(ComponentType type) throws ComponentInstantiationException
- Specified by:
createRootComponent
in interfaceComponentFactory
- Throws:
ComponentInstantiationException
-
getMetaData
public ComponentFactory.MetaData<? extends Component> getMetaData(ComponentType type)
- Specified by:
getMetaData
in interfaceComponentFactory
-
getRootMetaData
public ComponentFactory.MetaData<? extends Root> getRootMetaData(ComponentType type)
- Specified by:
getRootMetaData
in interfaceComponentFactory
-
add
protected void add(String type, AbstractComponentFactory.Data<? extends Component> info)
-
addRoot
protected void addRoot(String type, AbstractComponentFactory.Data<? extends Root> info)
-
data
public static <T> AbstractComponentFactory.Data<T> data(Class<T> cls)
-
-