Top Description Fields Constructors Methods
org.h2.mvstore.type

public final Class MetaType<D>

extends BasicDataType<DataType<?>>
Class Inheritance
Type Parameters
<D>
type of opaque parameter passed as an operational context to Factory.create()
Imports
java.nio.ByteBuffer, java.util.HashMap, .Map, org.h2.engine.Constants, org.h2.mvstore.DataUtils, .WriteBuffer

Class DBMetaType is a type for values in the type registry map.
Author
Andrei Tokar

Field Summary

Modifier and TypeField and Description
private final Map<String, Object>
private final D
private final Thread.UncaughtExceptionHandler

Constructor Summary

AccessConstructor and Description
public
MetaType(D database, Thread.UncaughtExceptionHandler exceptionHandler)

Method Summary

Modifier and TypeMethod and Description
public int
compare(DataType<?>
the first key
a
,
DataType<?>
the second key
b
)

Overrides org.h2.mvstore.type.BasicDataType.compare.

Implements org.h2.mvstore.type.DataType.compare.

Compare two keys.

public DataType<?>[]
createStorage(int
number of values to hold
size
)

Implements org.h2.mvstore.type.DataType.createStorage.

Create storage object of array type to hold values

public int
getMemory(DataType<?>
the object
obj
)

Implements abstract org.h2.mvstore.type.BasicDataType.getMemory.

Implements org.h2.mvstore.type.DataType.getMemory.

Calculates the amount of used memory in bytes.

public DataType<?>
read(ByteBuffer
the source buffer
buff
)

Implements abstract org.h2.mvstore.type.BasicDataType.read.

Implements org.h2.mvstore.type.DataType.read.

Read an object.

public void
write(WriteBuffer
the target buffer
buff
,
DataType<?>
the value
obj
)

Implements abstract org.h2.mvstore.type.BasicDataType.write.

Implements org.h2.mvstore.type.DataType.write.

Write an object.

Inherited from org.h2.mvstore.type.BasicDataType:
binarySearchcastequalshashCodeisMemoryEstimationAllowedreadwrite

Field Detail

cacheback to summary
private final Map<String, Object> cache
databaseback to summary
private final D database
exceptionHandlerback to summary
private final Thread.UncaughtExceptionHandler exceptionHandler

Constructor Detail

MetaTypeback to summary
public MetaType(D database, Thread.UncaughtExceptionHandler exceptionHandler)

Method Detail

compareback to summary
public int compare(DataType<?> a, DataType<?> b)

Overrides org.h2.mvstore.type.BasicDataType.compare.

Implements org.h2.mvstore.type.DataType.compare.

Doc from org.h2.mvstore.type.DataType.compare.

Compare two keys.

Parameters
a:DataType<?>

the first key

b:DataType<?>

the second key

Returns:int

-1 if the first key is smaller, 1 if larger, and 0 if equal

Annotations
@Override
createStorageback to summary
public DataType<?>[] createStorage(int size)

Implements org.h2.mvstore.type.DataType.createStorage.

Doc from org.h2.mvstore.type.DataType.createStorage.

Create storage object of array type to hold values

Parameters
size:int

number of values to hold

Returns:DataType<?>[]

storage object

Annotations
@Override
getMemoryback to summary
public int getMemory(DataType<?> obj)

Implements abstract org.h2.mvstore.type.BasicDataType.getMemory.

Implements org.h2.mvstore.type.DataType.getMemory.

Doc from org.h2.mvstore.type.DataType.getMemory.

Calculates the amount of used memory in bytes.

Parameters
obj:DataType<?>

the object

Returns:int

the used memory

Annotations
@Override
readback to summary
public DataType<?> read(ByteBuffer buff)

Implements abstract org.h2.mvstore.type.BasicDataType.read.

Implements org.h2.mvstore.type.DataType.read.

Doc from org.h2.mvstore.type.DataType.read.

Read an object.

Parameters
buff:ByteBuffer

the source buffer

Returns:DataType<?>

the object

Annotations
@SuppressWarnings:unchecked
@Override
writeback to summary
public void write(WriteBuffer buff, DataType<?> obj)

Implements abstract org.h2.mvstore.type.BasicDataType.write.

Implements org.h2.mvstore.type.DataType.write.

Doc from org.h2.mvstore.type.DataType.write.

Write an object.

Parameters
buff:WriteBuffer

the target buffer

obj:DataType<?>

the value

Annotations
@SuppressWarnings:unchecked
@Override