Class CodeFactory<D extends CodeDelegate>

    • 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 code
        type - the component type
        defaultCls - precompiled default delegate
        template - 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 code
        type - the component type
        template - 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