Class ModelloTask

  • All Implemented Interfaces:
    java.lang.Cloneable

    public class ModelloTask
    extends org.apache.tools.ant.Task
    Ant task running Modello generators, the counterpart of the modello-maven-plugin goals.

    Required: version, outputDirectory, at least one nested <model> and one <goal>. Each model is generated once per goal; see README.md for all attributes and nested elements.

    • Field Summary

      • Fields inherited from class org.apache.tools.ant.Task

        target, taskName, taskType, wrapper
      • Fields inherited from class org.apache.tools.ant.ProjectComponent

        description, location, project
    • Constructor Summary

      Constructors 
      Constructor Description
      ModelloTask()  
    • Constructor Detail

      • ModelloTask

        public ModelloTask()
    • Method Detail

      • setVersion

        public void setVersion​(java.lang.String version)
        Model version to generate. Required.
      • setVelocityBasedir

        public void setVelocityBasedir​(java.io.File velocityBasedir)
        Base directory of Velocity templates; defaults to the project base directory.
      • setOutputDirectory

        public void setOutputDirectory​(java.io.File outputDirectory)
        Directory for generated files; created if missing. Required.
      • setPackageWithVersion

        public void setPackageWithVersion​(boolean packageWithVersion)
        Append the version to generated package names. Default false.
      • setPackagedVersions

        public void setPackagedVersions​(java.lang.String packagedVersions)
        Comma-separated historical versions, each generated into a versioned package.
      • setJavaSource

        public void setJavaSource​(java.lang.String javaSource)
        Java source level of generated code. Default 8.
      • setEncoding

        public void setEncoding​(java.lang.String encoding)
        Encoding of generated files. Default utf-8.
      • setDomAsXpp3

        public void setDomAsXpp3​(boolean domAsXpp3)
        Map DOM content to Xpp3Dom instead of org.w3c.dom.Element. Default true.
      • setLicenseFile

        public void setLicenseFile​(java.io.File licenseFile)
        File with license header text. Exclusive with setLicenseText(String).
      • setLicenseText

        public void setLicenseText​(java.lang.String licenseText)
        License header text. Exclusive with setLicenseFile(File).
      • setExtendedClassnameSuffix

        public void setExtendedClassnameSuffix​(java.lang.String extendedClassnameSuffix)
        Writer class name suffix for xpp3-extended-writer. Default Ex.
      • setXsdFileName

        public void setXsdFileName​(java.lang.String xsdFileName)
        Output file name for the xsd goal.
      • setEnforceMandatoryElements

        public void setEnforceMandatoryElements​(boolean enforceMandatoryElements)
        Enforce mandatory elements in the generated XSD. Default false.
      • setJsonSchemaFileName

        public void setJsonSchemaFileName​(java.lang.String jsonSchemaFileName)
        Output file name for the jsonschema goal.
      • setFirstVersion

        public void setFirstVersion​(java.lang.String firstVersion)
        First model version; xdoc shows the 'since' column for newer versions.
      • setXdocFileName

        public void setXdocFileName​(java.lang.String xdocFileName)
        Output file name for the xdoc goal.
      • addConfiguredModel

        public void addConfiguredModel​(ModelloTask.ModelElement m)
        Nested <model file="..."/>: model file to read. At least one required.
      • addConfiguredTemplate

        public void addConfiguredTemplate​(ModelloTask.NameElement t)
        Nested <template name="..."/>: Velocity template relative to velocityBasedir.
      • addConfiguredGoal

        public void addConfiguredGoal​(ModelloTask.NameElement g)
        Nested <goal name="..."/>: generator id, e.g. java. At least one required.
      • addConfiguredParam

        public void addConfiguredParam​(ModelloTask.ParamElement p)
        Nested <param name="..." value="..."/>: parameter passed to Velocity templates.
      • addConfiguredPluralException

        public void addConfiguredPluralException​(ModelloTask.ParamElement p)
        Nested <pluralException name="plural" value="singular"/>.
      • addConfiguredProperty

        public void addConfiguredProperty​(ModelloTask.ParamElement p)
        Nested <property name="..." value="..."/>: raw Modello parameter.
      • addConfiguredLicense

        public void addConfiguredLicense​(ModelloTask.LicenseElement l)
        Nested <license file="..."/> or <license>text</license>; only one source allowed.
      • execute

        public void execute()
                     throws org.apache.tools.ant.BuildException
        Overrides:
        execute in class org.apache.tools.ant.Task
        Throws:
        org.apache.tools.ant.BuildException