Class EglTemplateFactory

    • Field Detail

      • root

        protected java.net.URI root
    • Constructor Detail

      • EglTemplateFactory

        public EglTemplateFactory()
      • EglTemplateFactory

        public EglTemplateFactory​(IEglContext context)
    • Method Detail

      • setDefaultFormatter

        public void setDefaultFormatter​(Formatter defaultFormatter)
      • setDefaultFormatters

        public void setDefaultFormatters​(Formatter... defaultFormatters)
      • setDefaultFormatters

        public void setDefaultFormatters​(java.util.Collection<Formatter> defaultFormatters)
      • setContext

        public void setContext​(IEglContext context)
      • initialiseRoot

        public boolean initialiseRoot​(java.net.URI root)
        Sets the root of this template factory, unless it has already been set.
        Parameters:
        root - The new root.
        Returns:
        true if the root was set as a result of this call, false if the root had already been initialized.
      • setRoot

        public void setRoot​(java.net.URI root)
      • getTemplateRoot

        public java.lang.String getTemplateRoot()
      • name

        protected java.lang.String name​(java.lang.String path)
      • load

        public EglTemplate load​(java.io.File file)
                         throws EglRuntimeException
        Loads an EglTemplate for the EGL code stored in the indicated file. Subclasses should override #createTemplate(String, URI), rather than this method, unless they wish to alter the way in which a file is transformed into an EglTemplateSpecification
        Throws:
        EglRuntimeException
      • load

        protected EglTemplate load​(java.lang.String code,
                                   java.io.File file)
                            throws EglRuntimeException
        Loads an EglTemplate for the given EGL code as though it were contained in the given File. Used for parsing "dirty" code (which has not yet been saved to disk). Subclasses should override #createTemplate(String, URI), rather than this method, unless they wish to alter the way in which a dirty resource is transformed into an EglTemplateSpecification
        Throws:
        EglRuntimeException
      • load

        public EglTemplate load​(java.lang.String path)
                         throws EglRuntimeException
        Loads an EglTemplate for the EGL code stored in the file at path. Subclasses should override #createTemplate(String, URI), rather than this method, unless they wish to alter the way in which a path is transformed into an EglTemplateSpecification
        Throws:
        EglRuntimeException
      • load

        public EglTemplate load​(java.net.URI resource)
                         throws EglRuntimeException
        Loads an EglTemplate for the EGL code stored in the given resource. Subclasses should override #createTemplate(String, URI), rather than this method, unless they wish to alter the way in which a resource is transformed into an EglTemplateSpecification
        Throws:
        EglRuntimeException
      • load

        protected EglTemplate load​(java.lang.String code,
                                   java.net.URI resource)
                            throws EglRuntimeException
        Loads an EglTemplate for the given EGL code as though it were contained in the given URI. Used for parsing "dirty" code (which has not yet been saved to disk). Subclasses should override #createTemplate(String, URI), rather than this method, unless they wish to alter the way in which a dirty resource is transformed into an EglTemplateSpecification
        Throws:
        EglRuntimeException
      • prepare

        public final EglTemplate prepare​(java.lang.String code)
                                  throws java.lang.Exception
        Prepares an EGL template that will execute the given EGL source code. Subclasses should override #createTemplate(String), rather than this method, as this method may, in the future, acquire additional responsibilities, such as exception handling.
        Throws:
        java.lang.Exception
      • createTemplate

        protected EglTemplate createTemplate​(EglTemplateSpecification spec)
                                      throws java.lang.Exception
        Creates a template from the given specification. Subclasses may override to create different types of template.
        Throws:
        java.lang.Exception
      • copyState

        public void copyState​(IEolContext delegate)
      • getContextForNewTemplate

        protected IEglContext getContextForNewTemplate()
        This method should be called when creating a new template from createTemplate(EglTemplateSpecification). The rationale is that in some cases this factory's context is not safe to be used directly, so a proxy or modifications may be needed instead.
        Returns:
        An appropriate context to be used for a new EglTemplate instance.
        Since:
        1.6
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object