org.apache.directory.mavibot.btree.serializer

## Class AbstractElementSerializer<T>

- java.lang.Object
- - org.apache.directory.mavibot.btree.serializer.AbstractElementSerializer<T>

- Type Parameters:
    `T` - The type for the element to serialize and compare
  All Implemented Interfaces:
    ElementSerializer<T>
  Direct Known Subclasses:
    BooleanSerializer, ByteArraySerializer, ByteSerializer, CharArraySerializer, CharSerializer, IntSerializer, LongArraySerializer, LongSerializer, ShortSerializer, StringSerializer

      public abstract class AbstractElementSerializer<T>
      extends Object
      implements ElementSerializer<T>

  An abstract ElementSerializer that implements comon methods
  Author:
    Apache Directory Project

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `AbstractElementSerializer(Comparator<T> comparator)` Create a new instance of Serializer

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `int` | `compare(T type1, T type2)` Returns the comparison of two types.
    `Comparator<T>` | `getComparator()`
    `Class<?>` | `getType()`

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

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

    - ### Methods inherited from interface org.apache.directory.mavibot.btree.serializer.ElementSerializer

      `deserialize, deserialize, fromBytes, fromBytes, serialize`

- - ### Constructor Detail

    - #### AbstractElementSerializer

          public AbstractElementSerializer(Comparator<T> comparator)

      Create a new instance of Serializer

  - ### Method Detail

    - #### compare

          public int compare(T type1,
                    T type2)

      Returns the comparison of two types.
      - If type1 < type2, return -1
      - If type1 > type2, return 1
      - If type1 == type2, return 0
      Specified by:
        `compare` in interface `ElementSerializer<T>`
      Parameters:
        `type1` - The first type to compare
        `type2` - The second type to compare
      Returns:
        The comparison result

    - #### getComparator

          public Comparator<T> getComparator()

      Specified by:
        `getComparator` in interface `ElementSerializer<T>`
      Returns:
        the comparator for the used type

    - #### getType

          public Class<?> getType()

      Specified by:
        `getType` in interface `ElementSerializer<T>`
      Returns:
        the type being serialized

Copyright © 2012–2015 Apache Mavibot Project Parent. All rights reserved.