本文整理汇总了Java中org.apache.avro.generic.GenericData.StringType类的典型用法代码示例。如果您正苦于以下问题:Java StringType类的具体用法?Java StringType怎么用?Java StringType使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
StringType类属于org.apache.avro.generic.GenericData包,在下文中一共展示了StringType类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: generateSchemaSources
import org.apache.avro.generic.GenericData.StringType; //导入依赖的package包/类
/**
* Generate schema class.
*
* @param schema the schema
* @param uniqueSchemas the unique schemas
* @return the list
* @throws IOException Signals that an I/O exception has occurred.
*/
public static List<JavaDynamicBean> generateSchemaSources(
Schema schema, Map<String, Schema> uniqueSchemas) throws IOException {
SpecificCompiler compiler = new SpecificCompiler(schema);
compiler.setStringType(StringType.String);
compiler.setFieldVisibility(FieldVisibility.PRIVATE);
File tmpdir = new File(System.getProperty("java.io.tmpdir"));
long value = RANDOM.nextLong();
if (value == Long.MIN_VALUE) {
// corner case
value = 0;
} else {
value = Math.abs(value);
}
File tmpOutputDir = new File(tmpdir, "tmp-gen-" + Long.toString(value));
tmpOutputDir.mkdirs();
compiler.compileToDestination(null, tmpOutputDir);
List<JavaDynamicBean> sources = getJavaSources(tmpOutputDir, uniqueSchemas);
tmpOutputDir.delete();
return sources;
}
开发者ID:kaaproject,项目名称:kaa,代码行数:34,代码来源:JavaSdkGenerator.java
示例2: process
import org.apache.avro.generic.GenericData.StringType; //导入依赖的package包/类
@TaskAction
protected void process() {
parsedStringType = Enums.parseCaseInsensitive(OPTION_STRING_TYPE, StringType.values(), getStringType());
parsedFieldVisibility =
Enums.parseCaseInsensitive(OPTION_FIELD_VISIBILITY, FieldVisibility.values(), getFieldVisibility());
getLogger().debug("Using outputCharacterEncoding {}", getOutputCharacterEncoding());
getLogger().debug("Using stringType {}", parsedStringType.name());
getLogger().debug("Using fieldVisibility {}", parsedFieldVisibility.name());
getLogger().debug("Using templateDirectory '{}'", getTemplateDirectory());
getLogger().debug("Using createSetters {}", isCreateSetters());
getLogger().debug("Using enableDecimalLogicalType {}", isEnableDecimalLogicalType());
getLogger().debug("Using validateDefaults {}", isValidateDefaults());
getLogger().info("Found {} files", getInputs().getSourceFiles().getFiles().size());
failOnUnsupportedFiles();
processFiles();
}
开发者ID:commercehub-oss,项目名称:gradle-avro-plugin,代码行数:17,代码来源:GenerateAvroJavaTask.java
示例3: avroCompile
import org.apache.avro.generic.GenericData.StringType; //导入依赖的package包/类
/**
* Given an Avro schema produce java specific classes.
*
* @param avroSchemaFile the Avro schema file (used by avro for timestamp
* checking)
* @param avroSchemaSource the Avro schema source
* @param javaTargetFolder the target folder for java classes
* @throws IOException if compilation fails
*/
private void avroCompile(String avroSchemaSource, File avroSchemaFile,
File javaTargetFolder) throws IOException {
log.debug("Avro compiler started for: {}", avroSchemaFile);
Schema.Parser parser = new Schema.Parser();
Schema schema = parser.parse(avroSchemaSource);
SpecificCompiler compiler = new CustomSpecificCompiler(schema);
compiler.setStringType(StringType.CharSequence);
compiler.compileToDestination(avroSchemaFile, javaTargetFolder);
log.debug("Avro compiler ended for: {}", avroSchemaFile);
}
开发者ID:legsem,项目名称:legstar.avro,代码行数:23,代码来源:Cob2AvroGenerator.java
示例4: setStringType
import org.apache.avro.generic.GenericData.StringType; //导入依赖的package包/类
public void setStringType(GenericData.StringType stringType) {
setStringType(stringType.name());
}
开发者ID:commercehub-oss,项目名称:gradle-avro-plugin,代码行数:4,代码来源:GenerateAvroJavaTask.java
注:本文中的org.apache.avro.generic.GenericData.StringType类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论