本文整理匯總了Java中org.apache.avro.Schema.Field.doc方法的典型用法代碼示例。如果您正苦於以下問題:Java Field.doc方法的具體用法?Java Field.doc怎麽用?Java Field.doc使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.apache.avro.Schema.Field
的用法示例。
在下文中一共展示了Field.doc方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: addExtras
import org.apache.avro.Schema.Field; //導入方法依賴的package包/類
private void addExtras(Field field) {
List<Entry<String, String>> extras = new ArrayList<>(3);
String dflt = defaultFor(field);
if (dflt != null) {
extras.add(new AbstractMap.SimpleEntry<String, String>("default", dflt));
}
String doc = field.doc();
if (doc != null) {
extras.add(new AbstractMap.SimpleEntry<String, String>("doc", doc));
}
String size = childIntNodeAsString(field, "size");
if (size!= null) {
extras.add(new AbstractMap.SimpleEntry<String, String>("size", size));
}
appendAsData(extras);
}
示例2: getRecordSchemaWithDirtySupport
import org.apache.avro.Schema.Field; //導入方法依賴的package包/類
private static Schema getRecordSchemaWithDirtySupport(Schema originalSchema, Map<Schema,Schema> queue) throws IOException {
if (originalSchema.getType() != Type.RECORD) {
throw new IOException("Gora only supports record schemas.");
}
List<Field> originalFields = originalSchema.getFields();
/* make sure the schema doesn't contain the field __g__dirty */
for (Field field : originalFields) {
if (GORA_RESERVED_NAMES.contains(field.name())) {
throw new IOException(
"Gora schemas cannot contain the field name " + field.name());
}
}
Schema newSchema = Schema.createRecord(originalSchema.getName(),
originalSchema.getDoc(), originalSchema.getNamespace(),
originalSchema.isError());
queue.put(originalSchema, newSchema);
List<Field> newFields = new ArrayList<>();
byte[] defaultDirtyBytesValue = new byte[getNumberOfBytesNeededForDirtyBits(originalSchema)];
Arrays.fill(defaultDirtyBytesValue, (byte) 0);
JsonNode defaultDirtyJsonValue = JsonNodeFactory.instance
.binaryNode(defaultDirtyBytesValue);
Field dirtyBits = new Field(DIRTY_BYTES_FIELD_NAME,
Schema.create(Type.BYTES),
"Bytes used to represent weather or not a field is dirty.",
defaultDirtyJsonValue);
newFields.add(dirtyBits);
for (Field originalField : originalFields) {
// recursively add dirty support
Field newField = new Field(originalField.name(),
getSchemaWithDirtySupport(originalField.schema(),queue),
originalField.doc(), originalField.defaultValue(),
originalField.order());
newFields.add(newField);
}
newSchema.setFields(newFields);
return newSchema;
}
示例3: getKeySchema
import org.apache.avro.Schema.Field; //導入方法依賴的package包/類
private Optional<Schema> getKeySchema(Field field) {
switch (field.schema().getType()) {
case RECORD:
return getKeySchemaFromRecord(field.schema());
default:
if (field.doc() != null && field.doc().toLowerCase().endsWith(SCHEMA_DEDUP_FIELD_ANNOTATOR)) {
return Optional.of(field.schema());
} else {
return Optional.absent();
}
}
}
示例4: getSchemaFieldsList
import org.apache.avro.Schema.Field; //導入方法依賴的package包/類
public static List<Field> getSchemaFieldsList(Schema schema) {
List<Field> result = new ArrayList<>();
for (Field f : schema.getFields()) {
Field nf = new Field(f.name(), f.schema(), f.doc(), f.defaultVal());
nf.getObjectProps().putAll(f.getObjectProps());
for (Map.Entry<String, Object> entry : f.getObjectProps().entrySet()) {
nf.addProp(entry.getKey(), entry.getValue());
}
result.add(nf);
}
return result;
}
示例5: generateNewField
import org.apache.avro.Schema.Field; //導入方法依賴的package包/類
public static Field generateNewField(Field origin) {
Schema.Field field = new Schema.Field(origin.name(), origin.schema(), origin.doc(), origin.defaultVal(), origin.order());
field.getObjectProps().putAll(origin.getObjectProps());
for (Map.Entry<String, Object> entry : origin.getObjectProps().entrySet()) {
field.addProp(entry.getKey(), entry.getValue());
}
return field;
}
示例6: getMigratedField
import org.apache.avro.Schema.Field; //導入方法依賴的package包/類
private Field getMigratedField(Field origin, Schema expectedSchema, String expectedDIType) {
Field expectedField = new Schema.Field(origin.name(), expectedSchema, origin.doc(), origin.defaultVal(), origin.order());
for (Map.Entry<String, Object> entry : origin.getObjectProps().entrySet()) {
if ("di.column.talendType".equals(entry.getKey())) {
expectedField.addProp("di.column.talendType", expectedDIType);
} else {
expectedField.addProp(entry.getKey(), entry.getValue());
}
}
return expectedField;
}