Class CodeFactory.Task<D extends CodeDelegate>

  • 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 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 calls createContext(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 to createCodeContext(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 is return new XXXCodeContext(new XXXCodeConnector(this, delegate));.
        Parameters:
        delegate - delegate to create context for
        Returns:
        code context