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
Modifier and TypeFieldDescriptionprotected boolean
The createNullSafeAnnotations parameter adds JetBrains @Nullable and @NotNull annotations for fhe fields of the record.protected boolean
The createOptionalGetters parameter enables generating the getOptional...protected boolean
Determines whether or not to create setters for the fields of the record.protected String[]
A set of fully qualified class names of customConversion
implementations to add to the compiler.protected String[]
A set of fully qualified class names of customLogicalTypes.LogicalTypeFactory
implementations to add to the compiler.protected boolean
Determines whether or not to use Java classes for decimal typesprotected String[]
A set of Ant-like exclusion patterns used to prevent certain files from being processed.protected boolean
The gettersReturnOptional parameter enables generating get... methods that return an Optional of the requested type.protected String[]
A list of files or directories that should be compiled first thus making them importable by subsequently compiled schemas.protected boolean
The optionalGettersForNullableFieldsOnly parameter works in conjunction with gettersReturnOptional option.protected org.apache.maven.project.MavenProject
The current Maven project.protected String
The Java type to use for Avro strings.protected String
The directory (within the java classpath) that contains the velocity templates to use for code generation.protected String[]
A set of Ant-like exclusion patterns used to prevent certain files from being processed.protected String[]
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
-
Method Summary
Modifier and TypeMethodDescriptionprotected URLClassLoader
protected void
doCompile
(File sourceFileForModificationDetection, Collection<Schema> schemas, File outputDirectory) protected void
protected void
protected void
void
execute()
protected SpecificCompiler.FieldVisibility
protected abstract String[]
protected abstract String[]
Methods inherited from class org.apache.maven.plugin.AbstractMojo
getLog, getPluginContext, setLog, setPluginContext
-
Field Details
-
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
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
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
The Java type to use for Avro strings. May be one of CharSequence, String or Utf8. CharSequence by default. -
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
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 createOptionalGettersThe createOptionalGetters parameter enables generating the getOptional... methods that return an Optional of the requested type. This works ONLY on Java 8+ -
gettersReturnOptional
protected boolean gettersReturnOptionalThe gettersReturnOptional parameter enables generating get... methods that return an Optional of the requested type. This works ONLY on Java 8+ -
optionalGettersForNullableFieldsOnly
protected boolean optionalGettersForNullableFieldsOnlyThe 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 createSettersDetermines whether or not to create setters for the fields of the record. The default is to create setters. -
createNullSafeAnnotations
protected boolean createNullSafeAnnotationsThe createNullSafeAnnotations parameter adds JetBrains @Nullable and @NotNull annotations for fhe fields of the record. The default is to not include annotations.- See Also:
-
customConversions
A set of fully qualified class names of customConversion
implementations to add to the compiler. The classes must be on the classpath at compile time and whenever the Java objects are serialized. -
customLogicalTypeFactories
A set of fully qualified class names of customLogicalTypes.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 enableDecimalLogicalTypeDetermines whether or not to use Java classes for decimal types -
project
protected org.apache.maven.project.MavenProject projectThe 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
-
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
-
getTestIncludes
-