本文整理匯總了Java中org.apache.avro.Schema.getFullName方法的典型用法代碼示例。如果您正苦於以下問題:Java Schema.getFullName方法的具體用法?Java Schema.getFullName怎麽用?Java Schema.getFullName使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.apache.avro.Schema
的用法示例。
在下文中一共展示了Schema.getFullName方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: internalValidate
import org.apache.avro.Schema; //導入方法依賴的package包/類
private void internalValidate(Schema schema) throws SchemaValidationException {
if (schema.getType() == RECORD) {
String name = schema.getFullName();
if (recordTypeNames.contains(name)) {
return;
}
recordTypeNames.add(name);
for (Field field : schema.getFields()) {
internalValidate(field.schema());
}
} else if (schema.getType() == MAP) {
internalValidate(schema.getValueType());
} else if (schema.getType() == ARRAY) {
internalValidate(schema.getElementType());
} else if (schema.getType() == UNION) {
boolean containsBytes = false;
boolean containsString = false;
for (Schema unionSchema : schema.getTypes()) {
if (unionSchema.getType() == Schema.Type.BYTES) {
containsBytes = true;
} else if (unionSchema.getType() == Schema.Type.STRING) {
containsString = true;
}
if (containsBytes && containsString) {
String message = "Schema contains a variant of union[bytes, string]: " + unionSchema.toString();
throw new SchemaValidationException(message);
}
if (COMPOSITE_TYPES.contains(unionSchema)) {
internalValidate(unionSchema);
}
}
}
}
示例2: schemaNameEquals
import org.apache.avro.Schema; //導入方法依賴的package包/類
/**
* Tests the equality of two Avro named schemas.
*
* <p> Matching includes reader name aliases. </p>
*
* @param reader Named reader schema.
* @param writer Named writer schema.
* @return whether the names of the named schemas match or not.
*/
public static boolean schemaNameEquals(final Schema reader, final Schema writer) {
final String writerFullName = writer.getFullName();
if (objectsEqual(reader.getFullName(), writerFullName)) {
return true;
}
// Apply reader aliases:
if (reader.getAliases().contains(writerFullName)) {
return true;
}
return false;
}