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 and Description
    --- | ---
    `static class` | `Conversions.BigDecimalConversion`
    `static class` | `Conversions.DecimalConversion`
    `static class` | `Conversions.UUIDConversion`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `Conversions()`

  - ### Method Summary

    All Methods Static Methods Concrete Methods
    Modifier and Type | Method and 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 Detail

    - #### Conversions

          public Conversions()

  - ### Method Detail

    - #### 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.

Copyright © 2009–2024 The Apache Software Foundation. All rights reserved.