Package org.apache.avro.mojo

# 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 Summary

Fields
Modifier and Type
Field
Description
`protected boolean`
`createNullSafeAnnotations`
The createNullSafeAnnotations parameter adds JetBrains @Nullable and @NotNull annotations for fhe fields of the record.
`protected boolean`
`createOptionalGetters`
The createOptionalGetters parameter enables generating the getOptional...
`protected boolean`
`createSetters`
Determines whether or not to create setters for the fields of the record.
`protected String[]`
`customConversions`
A set of fully qualified class names of custom `Conversion` implementations to add to the compiler.
`protected String[]`
`customLogicalTypeFactories`
A set of fully qualified class names of custom `LogicalTypes.LogicalTypeFactory` implementations to add to the compiler.
`protected boolean`
`enableDecimalLogicalType`
Determines whether or not to use Java classes for decimal types
`protected String[]`
`excludes`
A set of Ant-like exclusion patterns used to prevent certain files from being processed.
`protected boolean`
`gettersReturnOptional`
The gettersReturnOptional parameter enables generating get... methods that return an Optional of the requested type.
`protected String[]`
`imports`
A list of files or directories that should be compiled first thus making them importable by subsequently compiled schemas.
`protected boolean`
`optionalGettersForNullableFieldsOnly`
The optionalGettersForNullableFieldsOnly parameter works in conjunction with gettersReturnOptional option.
`protected org.apache.maven.project.MavenProject`
`project`
The current Maven project.
`protected String`
`stringType`
The Java type to use for Avro strings.
`protected String`
`templateDirectory`
The directory (within the java classpath) that contains the velocity templates to use for code generation.
`protected String[]`
`testExcludes`
A set of Ant-like exclusion patterns used to prevent certain files from being processed.
`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.

### Fields inherited from interface org.apache.maven.plugin.Mojo

`ROLE`

## Constructor Summary

Constructors
Constructor
Description
`AbstractAvroMojo()`

## Method Summary

Modifier and Type
Method
Description
`protected URLClassLoader`
`createClassLoader()`
`protected void`
`doCompile(File sourceFileForModificationDetection, Collection<org.apache.avro.Schema> schemas, File outputDirectory)`
`protected void`
`doCompile(File sourceFileForModificationDetection, org.apache.avro.Protocol protocol, File outputDirectory)`
`protected void`
`doCompile(String[] files, File sourceDirectory, File outputDirectory)`
`protected void`
`doCompile(String filename, File sourceDirectory, File outputDirectory)`
`void`
`execute()`
`protected List<URL>`
`findClasspath()`
`protected org.apache.avro.compiler.specific.SpecificCompiler.FieldVisibility`
`getFieldVisibility()`
`protected abstract String[]`
`getIncludes()`
`protected abstract String[]`
`getTestIncludes()`
`protected List<Object>`
`instantiateAdditionalVelocityTools()`

### Methods inherited from class org.apache.maven.plugin.AbstractMojo

`getLog, getPluginContext, setLog, setPluginContext`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## 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:
  - JetBrains nullability annotations

### 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 org.apache.avro.compiler.specific.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<org.apache.avro.Schema> schemas, File outputDirectory) throws IOException

Throws:
  `IOException`

### doCompile

protected void doCompile(File sourceFileForModificationDetection, org.apache.avro.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()