public class SpecificCompiler extends Object
Modifier and Type | Class and Description |
---|---|
static class |
SpecificCompiler.FieldVisibility |
static class |
SpecificCompiler.Slf4jLogChute |
Constructor and Description |
---|
SpecificCompiler(Protocol protocol) |
SpecificCompiler(Schema schema) |
Modifier and Type | Method and Description |
---|---|
static void |
compileProtocol(File[] srcFiles,
File dest)
Generates Java interface and classes for a number of protocol files.
|
static void |
compileProtocol(File src,
File dest)
Generates Java interface and classes for a protocol.
|
static void |
compileSchema(File[] srcFiles,
File dest)
Generates Java classes for a number of schema files.
|
static void |
compileSchema(File src,
File dest)
Generates Java classes for a schema.
|
void |
compileToDestination(File src,
File dst)
Generate output under dst, unless existing file is newer than src.
|
boolean |
deprecatedFields() |
static String |
escapeForJavadoc(String s)
Utility for template use.
|
static String |
generateClearMethod(Schema schema,
Schema.Field field)
Generates the name of a field "clear" method.
|
static String |
generateGetMethod(Schema schema,
Schema.Field field)
Generates the name of a field accessor method.
|
static String |
generateHasMethod(Schema schema,
Schema.Field field)
Generates the name of a field "has" method.
|
static String |
generateSetMethod(Schema schema,
Schema.Field field)
Generates the name of a field mutator method.
|
boolean |
isCreateSetters() |
static boolean |
isUnboxedJavaTypeNullable(Schema schema)
Tests whether an unboxed Java type can be set to null
|
String[] |
javaAnnotations(JsonProperties props)
Utility for template use.
|
static String |
javaEscape(Object o)
Utility for template use.
|
String |
javaType(Schema schema)
Utility for template use.
|
String |
javaUnbox(Schema schema)
Utility for template use.
|
static void |
main(String[] args) |
static String |
mangle(String word)
Utility for template use.
|
static String |
mangle(String word,
boolean isError)
Utility for template use.
|
static String |
mangle(String word,
Set<String> reservedWords)
Utility for template use.
|
static String |
mangle(String word,
Set<String> reservedWords,
boolean isMethod)
Utility for template use.
|
static String |
nullToEmpty(String x)
Utility for template use.
|
boolean |
privateFields() |
boolean |
publicFields() |
void |
setCreateSetters(boolean createSetters)
Set to false to not create setter methods for the fields of the record.
|
void |
setFieldVisibility(SpecificCompiler.FieldVisibility fieldVisibility)
Sets the field visibility option.
|
void |
setStringType(GenericData.StringType t)
Set the Java type to be emitted for string schemas.
|
void |
setTemplateDir(String templateDir)
Set the resource directory where templates reside.
|
public SpecificCompiler(Protocol protocol)
public SpecificCompiler(Schema schema)
public void setTemplateDir(String templateDir)
public boolean deprecatedFields()
public boolean publicFields()
public boolean privateFields()
public void setFieldVisibility(SpecificCompiler.FieldVisibility fieldVisibility)
public boolean isCreateSetters()
public void setCreateSetters(boolean createSetters)
public static void compileProtocol(File src, File dest) throws IOException
src
- the source Avro protocol filedest
- the directory to place generated files inIOException
public static void compileProtocol(File[] srcFiles, File dest) throws IOException
srcFiles
- the source Avro protocol filesdest
- the directory to place generated files inIOException
public static void compileSchema(File src, File dest) throws IOException
IOException
public static void compileSchema(File[] srcFiles, File dest) throws IOException
IOException
public void compileToDestination(File src, File dst) throws IOException
IOException
public void setStringType(GenericData.StringType t)
public String javaType(Schema schema)
public String javaUnbox(Schema schema)
public String[] javaAnnotations(JsonProperties props)
public static String javaEscape(Object o)
public static String escapeForJavadoc(String s)
public static String nullToEmpty(String x)
public static String mangle(String word)
public static String mangle(String word, boolean isError)
public static String mangle(String word, Set<String> reservedWords)
public static String mangle(String word, Set<String> reservedWords, boolean isMethod)
public static String generateGetMethod(Schema schema, Schema.Field field)
schema
- the schema in which the field is defined.field
- the field for which to generate the accessor name.public static String generateSetMethod(Schema schema, Schema.Field field)
schema
- the schema in which the field is defined.field
- the field for which to generate the accessor name.public static String generateHasMethod(Schema schema, Schema.Field field)
schema
- the schema in which the field is defined.field
- the field for which to generate the accessor name.public static String generateClearMethod(Schema schema, Schema.Field field)
schema
- the schema in which the field is defined.field
- the field for which to generate the accessor name.public static boolean isUnboxedJavaTypeNullable(Schema schema)
Copyright © 2009-2012 The Apache Software Foundation. All Rights Reserved.