本文整理汇总了Java中org.apache.avro.Schema.getName方法的典型用法代码示例。如果您正苦于以下问题:Java Schema.getName方法的具体用法?Java Schema.getName怎么用?Java Schema.getName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.avro.Schema
的用法示例。
在下文中一共展示了Schema.getName方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: writeAvroSchema
import org.apache.avro.Schema; //导入方法依赖的package包/类
private void writeAvroSchema(final Schema schema) throws IOException {
// Generate schema in JAR output directory.
final File schemaFile = new File(options.getJarOutputDir(), schema.getName() + ".avsc");
LOG.info("Writing Avro schema file: " + schemaFile);
FileUtils.forceMkdir(schemaFile.getParentFile());
FileUtils.writeStringToFile(schemaFile, schema.toString(true));
// Copy schema to code output directory.
try {
FileUtils.moveFileToDirectory(schemaFile, new File(options.getCodeOutputDir()), true);
} catch (final IOException e) {
LOG.debug("Could not move Avro schema file to code output directory.", e);
}
}
示例2: AvroUnionSchema
import org.apache.avro.Schema; //导入方法依赖的package包/类
public AvroUnionSchema( final Schema avroSchema ) throws IOException{
this.avroSchema = avroSchema;
schema = new UnionField( avroSchema.getName() );
for( Schema childSchema : avroSchema.getTypes() ){
IField childField = AvroSchemaFactory.getGeneralSchema( avroSchema.getName() , childSchema );
schema.set( childField );
}
}
示例3: AvroRecordSchema
import org.apache.avro.Schema; //导入方法依赖的package包/类
public AvroRecordSchema( final Schema avroSchema ) throws IOException{
this.avroSchema = avroSchema;
schema = new StructContainerField( avroSchema.getName() );
for( Schema.Field field : avroSchema.getFields() ){
schema.set( AvroSchemaFactory.getGeneralSchema( field.name() , field.schema() ) );
}
}
示例4: getSchemaName
import org.apache.avro.Schema; //导入方法依赖的package包/类
protected String getSchemaName(Schema schema, NodeType type) {
switch (type) {
case UNION:
case ARRAY:
case MAP:
return type.toString().toLowerCase();
case PRIMITIVE_TYPE:
PrimitiveType primitiveType = PrimitiveType.getPrimitiveType(schema);
return primitiveType.getName();
case ROOT:
return "root";
default:
return schema.getName();
}
}
示例5: getFullName
import org.apache.avro.Schema; //导入方法依赖的package包/类
protected String getFullName(Schema schema) {
String name = schema.getName();
String namespace = schema.getNamespace();
// debug purpose
//String fullName = schema.getFullName();
return getFullName(namespace, name);
}
示例6: getName
import org.apache.avro.Schema; //导入方法依赖的package包/类
protected String getName(Schema schema) {
return schema.getName();
}
示例7: checkSchemaFile
import org.apache.avro.Schema; //导入方法依赖的package包/类
private void checkSchemaFile(final Schema schema) throws IOException {
final File schemaFile = new File(schema.getName() + ".avsc");
assertTrue(schemaFile.exists());
assertEquals(schema, new Schema.Parser().parse(schemaFile));
}