Package org.apache.avro
Class Conversions
java.lang.Object
org.apache.avro.Conversions
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
static class
static class
static class
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic Object
convertToLogicalType
(Object datum, Schema schema, LogicalType type, Conversion<?> conversion) Convert an underlying representation of a logical type (such as a ByteBuffer) to a higher level object (such as a BigDecimal).static <T> Object
convertToRawType
(Object datum, Schema schema, LogicalType type, Conversion<T> conversion) Convert a high level representation of a logical type (such as a BigDecimal) to its underlying representation object (such as a ByteBuffer)
-
Constructor Details
-
Conversions
public Conversions()
-
-
Method Details
-
convertToLogicalType
public static Object convertToLogicalType(Object datum, Schema schema, LogicalType type, Conversion<?> conversion) Convert an underlying representation of a logical type (such as a ByteBuffer) to a higher level object (such as a BigDecimal).- Parameters:
datum
- The object to be converted.schema
- The schema of datum. Cannot be null if datum is not null.type
- TheLogicalType
of datum. Cannot be null if datum is not null.conversion
- The tool used to finish the conversion. Cannot be null if datum is not null.- Returns:
- The result object, which is a high level object of the logical type. The null datum always converts to a null value.
- Throws:
IllegalArgumentException
- if datum is not null, but schema, type or conversion is.
-
convertToRawType
public static <T> Object convertToRawType(Object datum, Schema schema, LogicalType type, Conversion<T> conversion) Convert a high level representation of a logical type (such as a BigDecimal) to its underlying representation object (such as a ByteBuffer)- Parameters:
datum
- The object to be converted.schema
- The schema of datum. Cannot be null if datum is not null.type
- TheLogicalType
of datum. Cannot be null if datum is not null.conversion
- The tool used to finish the conversion. Cannot be null if datum is not null.- Returns:
- The result object, which is an underlying representation object of the logical type. If the input param datum is null, a null value will be returned.
- Throws:
IllegalArgumentException
- if datum is not null, but schema, type or conversion is.
-