Package org.apache.avro

# Class Conversions

java.lang.Object
org.apache.avro.Conversions

public class Conversions extends Object

## Nested Class Summary

Nested Classes
Modifier and Type
Class
Description
`static class`
`Conversions.BigDecimalConversion`
`static class`
`Conversions.DecimalConversion`
`static class`
`Conversions.DurationConversion`
`static class`
`Conversions.UUIDConversion`

## Constructor Summary

Constructors
Constructor
Description
`Conversions()`

## Method Summary

Modifier and Type
Method
Description
`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).
`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)

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## 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` - The `LogicalType` 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` - The `LogicalType` 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.