com.thinkaurelius.titan.graphdb.database.serialize.attribute

## Class AbstractDecimal.AbstractDecimalSerializer<V extends AbstractDecimal>

- java.lang.Object
- - com.thinkaurelius.titan.graphdb.database.serialize.attribute.AbstractDecimal.AbstractDecimalSerializer<V>

- All Implemented Interfaces:
    AttributeHandler<V>, AttributeSerializer<V>, OrderPreservingSerializer<V>
  Direct Known Subclasses:
    Decimal.DecimalSerializer, Precision.PrecisionSerializer
  Enclosing class:
    AbstractDecimal

      public abstract static class AbstractDecimal.AbstractDecimalSerializer<V extends AbstractDecimal>
      extends Object
      implements OrderPreservingSerializer<V>

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `AbstractDecimal.AbstractDecimalSerializer(int decimals, Class<V> type)`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected abstract V` | `construct(long format, int decimals)`
    `V` | `convert(Object value)` Converts the given (not-null) value to the expected datatype V.
    `V` | `read(ScanBuffer buffer)` Reads an attribute from the given ReadBuffer.
    `V` | `readByteOrder(ScanBuffer buffer)` Reads an attribute from the given ReadBuffer assuming it was written in byte order.
    `void` | `verifyAttribute(V value)` Verifies the given (not-null) attribute value is valid.
    `void` | `write(WriteBuffer buffer, V attribute)` Writes the attribute value to the given WriteBuffer.
    `void` | `writeByteOrder(WriteBuffer buffer, V attribute)` Writes the attribute value to the given WriteBuffer such that the byte order of the result is equal to the natural order of the attribute.

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

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

- - ### Constructor Detail

    - #### AbstractDecimal.AbstractDecimalSerializer

          public AbstractDecimal.AbstractDecimalSerializer(int decimals,
                                                   Class<V> type)

  - ### Method Detail

    - #### construct

          protected abstract V construct(long format,
                    int decimals)

    - #### read

          public V read(ScanBuffer buffer)

      Description copied from interface: `AttributeSerializer`
      Reads an attribute from the given ReadBuffer.

      It is expected that this read operation adjusts the position in the ReadBuffer to after the attribute value.
      Specified by:
        `read` in interface `AttributeSerializer<V extends AbstractDecimal>`
      Parameters:
        `buffer` - ReadBuffer to read attribute from
      Returns:
        Read attribute

    - #### write

          public void write(WriteBuffer buffer,
                   V attribute)

      Description copied from interface: `AttributeSerializer`
      Writes the attribute value to the given WriteBuffer.

      It is expected that this write operation adjusts the position in the WriteBuffer to after the attribute value.
      Specified by:
        `write` in interface `AttributeSerializer<V extends AbstractDecimal>`
      Parameters:
        `buffer` - WriteBuffer to write attribute to
        `attribute` - Attribute to write to WriteBuffer

    - #### readByteOrder

          public V readByteOrder(ScanBuffer buffer)

      Description copied from interface: `OrderPreservingSerializer`
      Reads an attribute from the given ReadBuffer assuming it was written in byte order.

      It is expected that this read operation adjusts the position in the ReadBuffer to after the attribute value.
      Specified by:
        `readByteOrder` in interface `OrderPreservingSerializer<V extends AbstractDecimal>`
      Parameters:
        `buffer` - ReadBuffer to read attribute from
      Returns:
        Read attribute

    - #### writeByteOrder

          public void writeByteOrder(WriteBuffer buffer,
                            V attribute)

      Description copied from interface: `OrderPreservingSerializer`
      Writes the attribute value to the given WriteBuffer such that the byte order of the result is equal to the natural order of the attribute.

      It is expected that this write operation adjusts the position in the WriteBuffer to after the attribute value.
      Specified by:
        `writeByteOrder` in interface `OrderPreservingSerializer<V extends AbstractDecimal>`
      Parameters:
        `buffer` - WriteBuffer to write attribute to
        `attribute` - Attribute to write to WriteBuffer

    - #### verifyAttribute

          public void verifyAttribute(V value)

      Description copied from interface: `AttributeHandler`
      Verifies the given (not-null) attribute value is valid. Throws an `IllegalArgumentException` if the value is invalid, otherwise simply returns.
      Specified by:
        `verifyAttribute` in interface `AttributeHandler<V extends AbstractDecimal>`
      Parameters:
        `value` - to verify

    - #### convert

          public V convert(Object value)

      Description copied from interface: `AttributeHandler`
      Converts the given (not-null) value to the expected datatype V. The given object will NOT be of type V. Throws an `IllegalArgumentException` if it cannot be converted.
      Specified by:
        `convert` in interface `AttributeHandler<V extends AbstractDecimal>`
      Parameters:
        `value` - to convert
      Returns:
        converted to expected datatype

Copyright © 2012–2014. All rights reserved.