public class DefaultStorageIdGenerator extends Object implements StorageIdGenerator
StorageIdGenerator implementation.
This class hashes the names into storage ID's in the range 507 (inclusive) to 65787 (exclusive); this corresponds to the range of values that are encoded in three bytes. This provides a target space of 65,280 possible storage IDs, so collisions should be extremely rare.
| Modifier and Type | Field and Description |
|---|---|
static int |
MAX_STORAGE_ID |
static int |
MIN_STORAGE_ID |
| Constructor and Description |
|---|
DefaultStorageIdGenerator() |
| Modifier and Type | Method and Description |
|---|---|
int |
generateClassStorageId(Class<?> type,
String name)
Generage a storage ID for a Java model class.
|
int |
generateCompositeIndexStorageId(Class<?> type,
String name,
int[] fields)
Generage a storage ID for a composite index.
|
int |
generateFieldStorageId(Method getter,
String name)
Generage a storage ID for a regular field.
|
int |
generateListElementStorageId(Method getter,
String name)
Generage a storage ID for a list field.
|
int |
generateMapKeyStorageId(Method getter,
String name)
Generage a storage ID for a map key field.
|
int |
generateMapValueStorageId(Method getter,
String name)
Generage a storage ID for a map value field.
|
int |
generateSetElementStorageId(Method getter,
String name)
Generage a storage ID for a set field.
|
public static final int MIN_STORAGE_ID
public static final int MAX_STORAGE_ID
public int generateClassStorageId(Class<?> type, String name)
StorageIdGeneratorgenerateClassStorageId in interface StorageIdGeneratortype - Java model classname - database type namepublic int generateCompositeIndexStorageId(Class<?> type, String name, int[] fields)
StorageIdGeneratorgenerateCompositeIndexStorageId in interface StorageIdGeneratortype - Java model class containing the indexed fieldsname - composite index namefields - indexed field storage ID's in index orderpublic int generateFieldStorageId(Method getter, String name)
StorageIdGeneratorgenerateFieldStorageId in interface StorageIdGeneratorgetter - the field's Java bean getter methodname - the field's database namepublic int generateSetElementStorageId(Method getter, String name)
StorageIdGeneratorgenerateSetElementStorageId in interface StorageIdGeneratorgetter - the field's Java bean getter methodname - the field's database namepublic int generateListElementStorageId(Method getter, String name)
StorageIdGeneratorgenerateListElementStorageId in interface StorageIdGeneratorgetter - the field's Java bean getter methodname - the field's database namepublic int generateMapKeyStorageId(Method getter, String name)
StorageIdGeneratorgenerateMapKeyStorageId in interface StorageIdGeneratorgetter - the field's Java bean getter methodname - the field's database namepublic int generateMapValueStorageId(Method getter, String name)
StorageIdGeneratorgenerateMapValueStorageId in interface StorageIdGeneratorgetter - the field's Java bean getter methodname - the field's database nameCopyright © 2017. All rights reserved.