- java.lang.Object
-
- org.praxislive.code.CodeFactory<D>
-
- Type Parameters:
D- base delegate type
- Direct Known Subclasses:
AudioCodeFactory,CoreCodeFactory,P2DCodeFactory,P3DCodeFactory,TFCodeFactory,VideoCodeFactory
public abstract class CodeFactory<D extends CodeDelegate> extends Object
A CodeFactory wraps configuration and task creation for creating code components and contexts for a given delegate base type.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classCodeFactory.Task<D extends CodeDelegate>A task for creating a component or context for a given delegate.
-
Constructor Summary
Constructors Modifier Constructor Description protectedCodeFactory(ClassBodyContext<D> cbc, ComponentType type, Class<? extends D> defaultCls, String template)Construct CodeFactory for a type extending the base code delegate type.protectedCodeFactory(ClassBodyContext<D> cbc, ComponentType type, String template)Construct CodeFactory for a type extending the base code delegate type.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description ClassBodyContext<D>getClassBodyContext()Class body context used to create wrapping class for source code.ComponentTypegetComponentType()Get the component type.Optional<Class<? extends D>>getDefaultDelegateClass()Optional precompiled version of the default delegate class.StringgetSourceTemplate()The source template corresponding to the default delegate class.abstract CodeFactory.Task<D>task()Create a task for constructing a context or component from a delegate class.
-
-
-
Constructor Detail
-
CodeFactory
protected CodeFactory(ClassBodyContext<D> cbc, ComponentType type, Class<? extends D> defaultCls, String template)
Construct CodeFactory for a type extending the base code delegate type. This constructor allows for a precompiled default delegate class to be provided. This must correspond to the code compiled from wrapping the provided class body template in the provided class body context.- Parameters:
cbc- class body context that will wrap source codetype- the component typedefaultCls- precompiled default delegatetemplate- code template reflecting default delegate
-
CodeFactory
protected CodeFactory(ClassBodyContext<D> cbc, ComponentType type, String template)
Construct CodeFactory for a type extending the base code delegate type. This constructor is used where the default delegate is compiled from the template at runtime.- Parameters:
cbc- class body context that will wrap source codetype- the component typetemplate- code template reflecting default delegate
-
-
Method Detail
-
getComponentType
public final ComponentType getComponentType()
Get the component type.- Returns:
- component type
-
getClassBodyContext
public final ClassBodyContext<D> getClassBodyContext()
Class body context used to create wrapping class for source code.- Returns:
- class body context
-
getSourceTemplate
public final String getSourceTemplate()
The source template corresponding to the default delegate class.- Returns:
- source template
-
getDefaultDelegateClass
public final Optional<Class<? extends D>> getDefaultDelegateClass()
Optional precompiled version of the default delegate class.- Returns:
- optional precompiled default delegate
-
task
public abstract CodeFactory.Task<D> task()
Create a task for constructing a context or component from a delegate class. This will return a suitable Task subclass that should be configured and used to create a context or component.- Returns:
- code factory task
-
-