/** Returns a copy of the descriptor with metadata set. */ public FieldType withMetadata(String metadata) { return toBuilder().setMetadata(metadata.getBytes(StandardCharsets.UTF_8)).build(); }
/** Create a {@link FieldType} for the given type. */ public static FieldType of(TypeName typeName) { return forTypeName(typeName).build(); }
/** Returns a copy of the descriptor with metadata set. */ public FieldType withMetadata(@Nullable byte[] metadata) { return toBuilder().setMetadata(metadata).build(); }
/** Create a map type for the given key and value types. */ public static final FieldType row(Schema schema) { return FieldType.forTypeName(TypeName.ROW).setRowSchema(schema).build(); }
public static final FieldType map( FieldType keyType, FieldType valueType, boolean valueTypeNullable) { return FieldType.forTypeName(TypeName.MAP) .setMapKeyType(keyType) .setMapValueType(valueType) .setMapValueTypeNullable(valueTypeNullable) .build(); }
/** Create an array type for the given field type. */ public static final FieldType array(FieldType elementType) { return FieldType.forTypeName(TypeName.ARRAY) .setCollectionElementType(elementType) .setCollectionElementTypeNullable(false) .build(); }
/** Create a map type for the given key and value types. */ public static final FieldType map(FieldType keyType, FieldType valueType) { return FieldType.forTypeName(TypeName.MAP) .setMapKeyType(keyType) .setMapValueType(valueType) .setMapValueTypeNullable(false) .build(); }
public static final FieldType array(FieldType elementType, boolean nullable) { return FieldType.forTypeName(TypeName.ARRAY) .setCollectionElementType(elementType) .setCollectionElementTypeNullable(nullable) .build(); }