Class TemplateLangWriter

    • Constructor Detail

      • TemplateLangWriter

        public TemplateLangWriter​(java.io.Writer out)
        Creates a build language writer.
        Parameters:
        out - the writer to write the elements to
    • Method Detail

      • getNonDefaultJavaExtensionCount

        private int getNonDefaultJavaExtensionCount​(Template template)
        Returns the number of non-default Java extensions in template.
        Parameters:
        template - the template to consider
        Returns:
        the number of non-default Java extensions
      • visitTemplate

        public java.lang.Object visitTemplate​(Template template)
                                       throws VilException
        Description copied from interface: IVisitor
        Visits a template.
        Specified by:
        visitTemplate in interface IVisitor
        Parameters:
        template - the template to visit
        Returns:
        the result of visiting the given statement (may be null)
        Throws:
        VilException - in case that visiting fails (e.g., execution)
      • printIndenationHint

        private void printIndenationHint​(IndentationConfiguration config)
        Prints the indentation hint related to the given config.
        Parameters:
        config - the configuration to be printed
      • printFormattingHint

        private void printFormattingHint​(FormattingConfiguration config)
        Prints the formatting hint related to the given config.
        Parameters:
        config - the configuration to be printed
      • printIndentationHintEntry

        private void printIndentationHintEntry​(java.lang.String name,
                                               int value)
        Prints the an indentation hint entry.
        Parameters:
        name - the name of the entry
        value - the actual value
      • printFormattingHintEntry

        private void printFormattingHintEntry​(java.lang.String name,
                                              java.lang.String value)
        Prints the an formatting hint entry.
        Parameters:
        name - the name of the entry
        value - the actual value
      • visitJavaExtension

        public java.lang.Object visitJavaExtension​(JavaExtension ext)
                                            throws VilException
        Description copied from interface: IVisitor
        Visits a java extension.
        Specified by:
        visitJavaExtension in interface IVisitor
        Parameters:
        ext - the java extension
        Returns:
        the result of visiting the given statement (may be null)
        Throws:
        VilException - in case that visiting fails (e.g., execution)
      • visitDef

        public java.lang.Object visitDef​(Def def)
                                  throws VilException
        Description copied from interface: IVisitor
        Visits a sub-template definition.
        Specified by:
        visitDef in interface IVisitor
        Parameters:
        def - the sub-template definition to visit
        Returns:
        the result of visiting the given statement (may be null)
        Throws:
        VilException - in case that visiting fails (e.g., execution)
      • visitTemplateBlock

        public java.lang.Object visitTemplateBlock​(TemplateBlock block)
                                            throws VilException
        Description copied from interface: IVisitor
        Visits a template block.
        Specified by:
        visitTemplateBlock in interface IVisitor
        Parameters:
        block - the template block to visit
        Returns:
        the result of visiting the given statement (may be null)
        Throws:
        VilException - in case that visiting fails (e.g., execution)
      • visitAlternative

        public java.lang.Object visitAlternative​(AlternativeStatement alternative)
                                          throws VilException
        Description copied from interface: IVisitor
        Visits an alternative statement.
        Specified by:
        visitAlternative in interface IVisitor
        Parameters:
        alternative - the alternative to visit
        Returns:
        the result of visiting the given statement (may be null)
        Throws:
        VilException - in case that visiting fails (e.g., execution)
      • printSeparatorExpression

        private void printSeparatorExpression​(Expression expression)
                                       throws VilException
        Prints a separator expression.
        Parameters:
        expression - the expression to be printed
        Throws:
        VilException - in case of evaluation problems
      • visitLoop

        public java.lang.Object visitLoop​(LoopStatement loop)
                                   throws VilException
        Description copied from interface: IVisitor
        Visits a loop statement.
        Specified by:
        visitLoop in interface IVisitor
        Parameters:
        loop - the loop statement to visit
        Returns:
        the result of visiting the given statement (may be null)
        Throws:
        VilException - in case that visiting fails (e.g., execution)
      • visitSwitch

        public java.lang.Object visitSwitch​(SwitchStatement swtch)
                                     throws VilException
        Description copied from interface: IVisitor
        Visits a switch statement.
        Specified by:
        visitSwitch in interface IVisitor
        Parameters:
        swtch - the switch statement to visit
        Returns:
        the result of visiting the given statement (may be null)
        Throws:
        VilException - in case that visiting fails (e.g., execution)
      • visitContentStatement

        public java.lang.Object visitContentStatement​(ContentStatement cnt)
                                               throws VilException
        Description copied from interface: IVisitor
        Visits a content statement.
        Specified by:
        visitContentStatement in interface IVisitor
        Parameters:
        cnt - the content statement
        Returns:
        the result of visiting the given statement (may be null)
        Throws:
        VilException - in case that visiting fails (e.g., execution)
      • visitTemplateCallExpression

        public java.lang.Object visitTemplateCallExpression​(TemplateCallExpression call)
                                                     throws VilException
        Description copied from interface: IVisitor
        Visits a template call expression.
        Specified by:
        visitTemplateCallExpression in interface IVisitor
        Parameters:
        call - the call expression
        Returns:
        the result of visiting the given expression (may be null)
        Throws:
        VilException - in case that visiting fails (e.g., execution)
      • visitWhile

        public java.lang.Object visitWhile​(WhileStatement stmt)
                                    throws VilException
        Description copied from interface: IVisitor
        Visits a while statement.
        Specified by:
        visitWhile in interface IVisitor
        Parameters:
        stmt - the while statement to visit
        Returns:
        the result of visiting the given statement (may be null)
        Throws:
        VilException - in case that visiting fails (e.g., execution)
      • visitFlush

        public java.lang.Object visitFlush​(FlushStatement stmt)
                                    throws VilException
        Description copied from interface: IVisitor
        Visits a flush statement.
        Specified by:
        visitFlush in interface IVisitor
        Parameters:
        stmt - the flush statement
        Returns:
        the result visiting the given statement (may be null)
        Throws:
        VilException - in case that visiting fails (e.g., execution)
      • visitContentLoopExpression

        public java.lang.Object visitContentLoopExpression​(ContentLoopExpression ex)
                                                    throws VilException
        Description copied from interface: IVisitor
        Visits a content loop expression.
        Specified by:
        visitContentLoopExpression in interface IVisitor
        Parameters:
        ex - the expression
        Returns:
        the result visiting the given statement (may be null)
        Throws:
        VilException - in case that visiting fails (e.g., execution)
      • visitContentVarDeclExpression

        public java.lang.Object visitContentVarDeclExpression​(ContentVarDeclExpression ex)
                                                       throws VilException
        Description copied from interface: IVisitor
        Visits a content variable declaration expression.
        Specified by:
        visitContentVarDeclExpression in interface IVisitor
        Parameters:
        ex - the expression
        Returns:
        the result visiting the given statement (may be null)
        Throws:
        VilException - in case that visiting fails (e.g., execution)