Class AbstractAvroMojo

java.lang.Object
org.apache.maven.plugin.AbstractMojo
org.apache.avro.mojo.AbstractAvroMojo
All Implemented Interfaces:
org.apache.maven.plugin.ContextEnabled, org.apache.maven.plugin.Mojo
Direct Known Subclasses:
IDLMojo, ProtocolMojo, SchemaMojo

public abstract class AbstractAvroMojo extends org.apache.maven.plugin.AbstractMojo
Base for Avro Compiler Mojos.
  • Field Details

    • imports

      protected String[] imports
      A list of files or directories that should be compiled first thus making them importable by subsequently compiled schemas. Note that imported files should not reference each other.
    • excludes

      protected String[] excludes
      A set of Ant-like exclusion patterns used to prevent certain files from being processed. By default, this set is empty such that no files are excluded.
    • testExcludes

      protected String[] testExcludes
      A set of Ant-like exclusion patterns used to prevent certain files from being processed. By default, this set is empty such that no files are excluded.
    • stringType

      protected String stringType
      The Java type to use for Avro strings. May be one of CharSequence, String or Utf8. CharSequence by default.
    • templateDirectory

      protected String templateDirectory
      The directory (within the java classpath) that contains the velocity templates to use for code generation. The default value points to the templates included with the avro-maven-plugin.
    • velocityToolsClassesNames

      protected String[] velocityToolsClassesNames
      The qualified names of classes which the plugin will look up, instantiate (through an empty constructor that must exist) and set up to be injected into Velocity templates by Avro compiler.
    • createOptionalGetters

      protected boolean createOptionalGetters
      The createOptionalGetters parameter enables generating the getOptional... methods that return an Optional of the requested type. This works ONLY on Java 8+
    • gettersReturnOptional

      protected boolean gettersReturnOptional
      The gettersReturnOptional parameter enables generating get... methods that return an Optional of the requested type. This works ONLY on Java 8+
    • optionalGettersForNullableFieldsOnly

      protected boolean optionalGettersForNullableFieldsOnly
      The optionalGettersForNullableFieldsOnly parameter works in conjunction with gettersReturnOptional option. If it is set, Optional getters will be generated only for fields that are nullable. If the field is mandatory, regular getter will be generated. This works ONLY on Java 8+.
    • createSetters

      protected boolean createSetters
      Determines whether or not to create setters for the fields of the record. The default is to create setters.
    • createNullSafeAnnotations

      protected boolean createNullSafeAnnotations
      The createNullSafeAnnotations parameter adds JetBrains @Nullable and @NotNull annotations for fhe fields of the record. The default is to not include annotations.
      See Also:
    • customConversions

      protected String[] customConversions
      A set of fully qualified class names of custom Conversion implementations to add to the compiler. The classes must be on the classpath at compile time and whenever the Java objects are serialized.
    • customLogicalTypeFactories

      protected String[] customLogicalTypeFactories
      A set of fully qualified class names of custom LogicalTypes.LogicalTypeFactory implementations to add to the compiler. The classes must be on the classpath at compile time and whenever the Java objects are serialized.
    • enableDecimalLogicalType

      protected boolean enableDecimalLogicalType
      Determines whether or not to use Java classes for decimal types
    • project

      protected org.apache.maven.project.MavenProject project
      The current Maven project.
  • Constructor Details

    • AbstractAvroMojo

      public AbstractAvroMojo()
  • Method Details

    • execute

      public void execute() throws org.apache.maven.plugin.MojoExecutionException
      Throws:
      org.apache.maven.plugin.MojoExecutionException
    • getFieldVisibility

      protected SpecificCompiler.FieldVisibility getFieldVisibility()
    • instantiateAdditionalVelocityTools

      protected List<Object> instantiateAdditionalVelocityTools()
    • doCompile

      protected void doCompile(String[] files, File sourceDirectory, File outputDirectory) throws org.apache.maven.plugin.MojoExecutionException
      Throws:
      org.apache.maven.plugin.MojoExecutionException
    • doCompile

      protected void doCompile(String filename, File sourceDirectory, File outputDirectory) throws IOException
      Throws:
      IOException
    • doCompile

      protected void doCompile(File sourceFileForModificationDetection, Collection<Schema> schemas, File outputDirectory) throws IOException
      Throws:
      IOException
    • doCompile

      protected void doCompile(File sourceFileForModificationDetection, Protocol protocol, File outputDirectory) throws IOException
      Throws:
      IOException
    • findClasspath

      protected List<URL> findClasspath() throws org.apache.maven.artifact.DependencyResolutionRequiredException, MalformedURLException
      Throws:
      org.apache.maven.artifact.DependencyResolutionRequiredException
      MalformedURLException
    • createClassLoader

      protected URLClassLoader createClassLoader() throws org.apache.maven.artifact.DependencyResolutionRequiredException, MalformedURLException
      Throws:
      org.apache.maven.artifact.DependencyResolutionRequiredException
      MalformedURLException
    • getIncludes

      protected abstract String[] getIncludes()
    • getTestIncludes

      protected abstract String[] getTestIncludes()