Package com.linkedin.venice.schema
Interface SchemaAdapter
- Record Components:
expectedSchema
- The typeSchema
that the value needs to be adapted to.datum
- The value that needs to be adapted to the specified schema
public interface SchemaAdapter
Try to adapt the to the .
The following steps are followed:
1. If the schema type doesn't allow for adaptation, return the same value that was passed in input.
2. If the schema type allows for adaptation, then
2a. If the value doesn't specify a value for any field, the default value is used
2b. If a field is mandatory, but no default values are specified, then an Exception is thrown
-
Method Summary
Modifier and TypeMethodDescriptionstatic Object
adaptToSchema
(org.apache.avro.Schema expectedSchema, Object datum) Checks if it is possible for some value to be modified to adapt to the provided schema type.static SchemaAdapter
getSchemaAdapter
(org.apache.avro.Schema.Type expectedSchemaType) Checks if it is possible for some value to be modified to adapt to the provided schema type.
-
Method Details
-
adapt
-
getSchemaAdapter
Checks if it is possible for some value to be modified to adapt to the provided schema type.- Parameters:
expectedSchemaType
- The typeSchema.Type
that the value needs to be adapted to.- Returns:
true
if a value can be modified to adapt to the provided schema type;false
otherwise.
-
adaptToSchema
Checks if it is possible for some value to be modified to adapt to the provided schema type.- Parameters:
expectedSchemaType
- The typeSchema.Type
that the value needs to be adapted to.- Returns:
true
if a value can be modified to adapt to the provided schema type;false
otherwise.
-