Package org.h2.mvstore.type

# Class MetaType<D>

java.lang.Object
org.h2.mvstore.type.BasicDataType<DataType<?>>
org.h2.mvstore.type.MetaType<D>

Type Parameters:
  `D` - type of opaque parameter passed as an operational context to Factory.create()

All Implemented Interfaces:
  `Comparator<DataType<?>>`, `DataType<DataType<?>>`

public final class MetaType<D> extends BasicDataType<DataType<?>>
Class DBMetaType is a type for values in the type registry map.

## Constructor Summary

Constructors
Constructor
Description
`MetaType(D database, Thread.UncaughtExceptionHandler exceptionHandler)`

## Method Summary

Modifier and Type
Method
Description
`int`
`compare(DataType<?> a, DataType<?> b)`
Compare two keys.
`DataType<?>[]`
`createStorage(int size)`
Create storage object of array type to hold values
`int`
`getMemory(DataType<?> obj)`
Calculates the amount of used memory in bytes.
`DataType<?>`
`read(ByteBuffer buff)`
Read an object.
`void`
`write(WriteBuffer buff, DataType<?> obj)`
Write an object.

### Methods inherited from class org.h2.mvstore.type.BasicDataType

`binarySearch, cast, equals, hashCode, isMemoryEstimationAllowed, read, write`

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

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

### Methods inherited from interface java.util.Comparator

`reversed, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLong`

## Constructor Details

### MetaType

public MetaType(D database, Thread.UncaughtExceptionHandler exceptionHandler)

## Method Details

### compare

public int compare(DataType<?> a, DataType<?> b)
Description copied from interface: `DataType`
Compare two keys.

Specified by:
  `compare` in interface `Comparator<D>`
Specified by:
  `compare` in interface `DataType<D>`
Overrides:
  `compare` in class `BasicDataType<DataType<?>>`
Parameters:
  `a` - the first key
  `b` - the second key
Returns:
  -1 if the first key is smaller, 1 if larger, and 0 if equal

### getMemory

public int getMemory(DataType<?> obj)
Description copied from interface: `DataType`
Calculates the amount of used memory in bytes.

Specified by:
  `getMemory` in interface `DataType<D>`
Specified by:
  `getMemory` in class `BasicDataType<DataType<?>>`
Parameters:
  `obj` - the object
Returns:
  the used memory

### write

public void write(WriteBuffer buff, DataType<?> obj)
Description copied from interface: `DataType`
Write an object.

Specified by:
  `write` in interface `DataType<D>`
Specified by:
  `write` in class `BasicDataType<DataType<?>>`
Parameters:
  `buff` - the target buffer
  `obj` - the value

### read

public DataType<?> read(ByteBuffer buff)
Description copied from interface: `DataType`
Read an object.

Specified by:
  `read` in interface `DataType<D>`
Specified by:
  `read` in class `BasicDataType<DataType<?>>`
Parameters:
  `buff` - the source buffer
Returns:
  the object

### createStorage

public DataType<?>[] createStorage(int size)
Description copied from interface: `DataType`
Create storage object of array type to hold values

Parameters:
  `size` - number of values to hold
Returns:
  storage object