Top Inners Constructors Methods
org.apache.avro

public Class Conversions

extends Object
Class Inheritance
Imports
java.math.RoundingMode, .BigDecimal, .BigInteger, org.apache.avro.generic.GenericData, .GenericEnumSymbol, .GenericFixed, .IndexedRecord, java.nio.ByteBuffer, java.util.Arrays, .Collection, .Map, .UUID

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static class
public static class

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public static Object

Returns:

The result object, which is a high level object of the logical type. The null datum always converts to a null value.
convertToLogicalType
(Object
The object to be converted.
datum
,
Schema
The schema of datum. Cannot be null if datum is not null.
schema
,
LogicalType
The org.apache.avro.LogicalType of datum. Cannot be null if datum is not null.
type
,
Conversion<?>
The tool used to finish the conversion. Cannot be null if datum is not null.
conversion
)

Convert an underlying representation of a logical type (such as a ByteBuffer) to a higher level object (such as a BigDecimal).

public static <T> Object

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.
convertToRawType
(Object
The object to be converted.
datum
,
Schema
The schema of datum. Cannot be null if datum is not null.
schema
,
LogicalType
The org.apache.avro.LogicalType of datum. Cannot be null if datum is not null.
type
,
Conversion<T>
The tool used to finish the conversion. Cannot be null if datum is not null.
conversion
)

Convert a high level representation of a logical type (such as a BigDecimal) to its underlying representation object (such as a ByteBuffer)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

Conversionsback to summary
public Conversions()

Method Detail

convertToLogicalTypeback to summary
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:Object

The object to be converted.

schema:Schema

The schema of datum. Cannot be null if datum is not null.

type:LogicalType

The org.apache.avro.LogicalType of datum. Cannot be null if datum is not null.

conversion:Conversion<?>

The tool used to finish the conversion. Cannot be null if datum is not null.

Returns:Object

The result object, which is a high level object of the logical type. The null datum always converts to a null value.

Exceptions
IllegalArgumentException:
if datum is not null, but schema, type or conversion is.
convertToRawTypeback to summary
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:Object

The object to be converted.

schema:Schema

The schema of datum. Cannot be null if datum is not null.

type:LogicalType

The org.apache.avro.LogicalType of datum. Cannot be null if datum is not null.

conversion:Conversion<T>

The tool used to finish the conversion. Cannot be null if datum is not null.

Returns:Object

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.

Exceptions
IllegalArgumentException:
if datum is not null, but schema, type or conversion is.
org.apache.avro back to summary

public Class Conversions.DecimalConversion

extends Conversion<BigDecimal>
Class Inheritance

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public BigDecimal
public BigDecimal
public Class<BigDecimal>
getConvertedType()

Implements abstract org.apache.avro.Conversion.getConvertedType.

Return the Java class representing the logical type.
public String
getLogicalTypeName()

Implements abstract org.apache.avro.Conversion.getLogicalTypeName.

Return the logical type this class converts.
public Schema
public ByteBuffer
public GenericFixed
private static BigDecimal
validate(final LogicalTypes.Decimal decimal, BigDecimal value)

Inherited from org.apache.avro.Conversion:
adjustAndSetValuefromArrayfromBooleanfromCharSequencefromDoublefromEnumSymbolfromFloatfromIntfromLongfromMapfromRecordtoArraytoBooleantoCharSequencetoDoubletoEnumSymboltoFloattoInttoLongtoMaptoRecord

Constructor Detail

DecimalConversionback to summary
public DecimalConversion()

Method Detail

fromBytesback to summary
public BigDecimal fromBytes(ByteBuffer value, Schema schema, LogicalType type)

Overrides org.apache.avro.Conversion.fromBytes.

Annotations
@Override
fromFixedback to summary
public BigDecimal fromFixed(GenericFixed value, Schema schema, LogicalType type)

Overrides org.apache.avro.Conversion.fromFixed.

Annotations
@Override
getConvertedTypeback to summary
public Class<BigDecimal> getConvertedType()

Implements abstract org.apache.avro.Conversion.getConvertedType.

Doc from org.apache.avro.Conversion.getConvertedType.

Return the Java class representing the logical type.

Returns:Class<BigDecimal>

a Java class returned by from methods and accepted by to methods

Annotations
@Override
getLogicalTypeNameback to summary
public String getLogicalTypeName()

Implements abstract org.apache.avro.Conversion.getLogicalTypeName.

Doc from org.apache.avro.Conversion.getLogicalTypeName.

Return the logical type this class converts.

Returns:String

a String logical type name

Annotations
@Override
getRecommendedSchemaback to summary
public Schema getRecommendedSchema()

Overrides org.apache.avro.Conversion.getRecommendedSchema.

Annotations
@Override
toBytesback to summary
public ByteBuffer toBytes(BigDecimal value, Schema schema, LogicalType type)

Overrides org.apache.avro.Conversion.toBytes.

Annotations
@Override
toFixedback to summary
public GenericFixed toFixed(BigDecimal value, Schema schema, LogicalType type)

Overrides org.apache.avro.Conversion.toFixed.

Annotations
@Override
validateback to summary
private static BigDecimal validate(final LogicalTypes.Decimal decimal, BigDecimal value)
org.apache.avro back to summary

public Class Conversions.UUIDConversion

extends Conversion<UUID>
Class Inheritance

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public UUID
public Class<UUID>
getConvertedType()

Implements abstract org.apache.avro.Conversion.getConvertedType.

Return the Java class representing the logical type.
public String
getLogicalTypeName()

Implements abstract org.apache.avro.Conversion.getLogicalTypeName.

Return the logical type this class converts.
public Schema
public CharSequence
Inherited from org.apache.avro.Conversion:
adjustAndSetValuefromArrayfromBooleanfromBytesfromDoublefromEnumSymbolfromFixedfromFloatfromIntfromLongfromMapfromRecordtoArraytoBooleantoBytestoDoubletoEnumSymboltoFixedtoFloattoInttoLongtoMaptoRecord

Constructor Detail

UUIDConversionback to summary
public UUIDConversion()

Method Detail

fromCharSequenceback to summary
public UUID fromCharSequence(CharSequence value, Schema schema, LogicalType type)

Overrides org.apache.avro.Conversion.fromCharSequence.

Annotations
@Override
getConvertedTypeback to summary
public Class<UUID> getConvertedType()

Implements abstract org.apache.avro.Conversion.getConvertedType.

Doc from org.apache.avro.Conversion.getConvertedType.

Return the Java class representing the logical type.

Returns:Class<UUID>

a Java class returned by from methods and accepted by to methods

Annotations
@Override
getLogicalTypeNameback to summary
public String getLogicalTypeName()

Implements abstract org.apache.avro.Conversion.getLogicalTypeName.

Doc from org.apache.avro.Conversion.getLogicalTypeName.

Return the logical type this class converts.

Returns:String

a String logical type name

Annotations
@Override
getRecommendedSchemaback to summary
public Schema getRecommendedSchema()

Overrides org.apache.avro.Conversion.getRecommendedSchema.

Annotations
@Override
toCharSequenceback to summary
public CharSequence toCharSequence(UUID value, Schema schema, LogicalType type)

Overrides org.apache.avro.Conversion.toCharSequence.

Annotations
@Override