Module org.praxislive.code
Package org.praxislive.code
Class CodeFactory.Task<D extends CodeDelegate>
- java.lang.Object
-
- org.praxislive.code.CodeFactory.Task<D>
-
- Type Parameters:
D- delegate base type
- Enclosing class:
- CodeFactory<D extends CodeDelegate>
public static class CodeFactory.Task<D extends CodeDelegate> extends Object
A task for creating a component or context for a given delegate.
-
-
Constructor Summary
Constructors Constructor Description Task(CodeFactory<D> factory)Construct a task for the given factory.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description CodeFactory.Task<D>attachLogging(LogBuilder log)Attach a log builder to the task.CodeFactory.Task<D>attachPrevious(Class<D> previous)Attach the previous iteration of delegate class, if available, that is being replaced.protected CodeContext<D>createCodeContext(D delegate)Create the code context for the given delegate.CodeComponent<D>createComponent(D delegate)Create a CodeComponent for the provided delegate.CodeContext<D>createContext(D delegate)Create a CodeContext for the provided delegate, for installation in an existing component.protected CodeFactory<D>getFactory()Get access to the CodeFactory this task was created for.protected LogBuildergetLog()Get the log for reporting messages during context creation.protected Class<D>getPrevious()Get the previous delegate class installed on the component.
-
-
-
Constructor Detail
-
Task
public Task(CodeFactory<D> factory)
Construct a task for the given factory.- Parameters:
factory-
-
-
Method Detail
-
attachLogging
public CodeFactory.Task<D> attachLogging(LogBuilder log)
Attach a log builder to the task.- Parameters:
log- log builder- Returns:
- this for chaining
-
attachPrevious
public CodeFactory.Task<D> attachPrevious(Class<D> previous)
Attach the previous iteration of delegate class, if available, that is being replaced. May be null.- Parameters:
previous- previous iteration of delegate class- Returns:
- this for chaining
-
createComponent
public CodeComponent<D> createComponent(D delegate)
Create a CodeComponent for the provided delegate. By default, this callscreateContext(org.praxislive.code.CodeDelegate)and installs the context on a new instance of CodeComponent.- Parameters:
delegate- delegate to create component for- Returns:
- code component
-
createContext
public CodeContext<D> createContext(D delegate)
Create a CodeContext for the provided delegate, for installation in an existing component. By default just calls through tocreateCodeContext(org.praxislive.code.CodeDelegate).- Parameters:
delegate- delegate to create context for- Returns:
- code context
-
getLog
protected LogBuilder getLog()
Get the log for reporting messages during context creation.- Returns:
- log builder
-
getPrevious
protected Class<D> getPrevious()
Get the previous delegate class installed on the component. May be null.- Returns:
- previous delegate class
-
getFactory
protected CodeFactory<D> getFactory()
Get access to the CodeFactory this task was created for.- Returns:
- code factory
-
createCodeContext
protected CodeContext<D> createCodeContext(D delegate)
Create the code context for the given delegate. A typical implementation isreturn new XXXCodeContext(new XXXCodeConnector(this, delegate));.- Parameters:
delegate- delegate to create context for- Returns:
- code context
-
-