|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.amazon.carbonado.raw.CustomStorableCodec<S>
public abstract class CustomStorableCodec<S extends Storable>
Allows codecs to be defined for storables that have a custom encoding.
CustomStorableCodecFactory| Nested Class Summary | |
|---|---|
static interface |
CustomStorableCodec.InstanceFactory
|
| Constructor Summary | |
|---|---|
CustomStorableCodec(Class<S> type,
boolean isMaster)
|
|
CustomStorableCodec(Class<S> type,
boolean isMaster,
RawSupport<S> support)
|
|
| Method Summary | |
|---|---|
StorableIndex<S> |
buildPkIndex(String... propertyNames)
Convenient way to define the clustered primary key index descriptor. |
abstract void |
decodeData(S storable,
byte[] bytes)
Decode the data into properties of the storable. |
abstract void |
decodePrimaryKey(S storable,
byte[] bytes)
Decode the primary key into properties of the storable. |
abstract byte[] |
encodeData(S storable)
Encode all properties of the storable excluding the primary key. |
byte[] |
encodePrimaryKey(Object[] values)
Encode a key by extracting all the primary key properties from the given storable. |
byte[] |
encodePrimaryKey(S storable)
Encode a key by extracting all the primary key properties from the given storable. |
Map<String,? extends StorableProperty<S>> |
getAllProperties()
Convenient access to all the storable properties. |
Class<S> |
getStorableType()
Returns the type of Storable produced by this codec. |
RawSupport<S> |
getSupport()
Returns the default RawSupport object that is supplied to
Storable instances produced by this codec. |
S |
instantiate()
Instantiate a Storable with no key or value defined yet. |
S |
instantiate(byte[] key,
byte[] value)
Instantiate a Storable with a specific key and value. |
S |
instantiate(RawSupport<S> support)
Instantiate a Storable with no key or value defined yet. |
S |
instantiate(RawSupport<S> support,
byte[] key,
byte[] value)
Instantiate a Storable with a specific key and value. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface com.amazon.carbonado.raw.StorableCodec |
|---|
decode, encodePrimaryKey, encodePrimaryKey, encodePrimaryKeyPrefix, getPrimaryKeyIndex, getPrimaryKeyPrefixLength |
| Constructor Detail |
|---|
public CustomStorableCodec(Class<S> type,
boolean isMaster)
throws SupportException
isMaster - when true, version properties and sequences are managed
SupportException - if Storable is not supported
public CustomStorableCodec(Class<S> type,
boolean isMaster,
RawSupport<S> support)
throws SupportException
isMaster - when true, version properties and sequences are managed
SupportException - if Storable is not supported| Method Detail |
|---|
public Class<S> getStorableType()
StorableCodec
getStorableType in interface StorableCodec<S extends Storable>public S instantiate()
StorableCodecRawSupport is supplied to the instance.
instantiate in interface StorableCodec<S extends Storable>
public S instantiate(byte[] key,
byte[] value)
throws FetchException
StorableCodecRawSupport is supplied to the instance.
instantiate in interface StorableCodec<S extends Storable>FetchExceptionpublic S instantiate(RawSupport<S> support)
StorableCodecRawSupport can be supplied to the instance.
instantiate in interface StorableCodec<S extends Storable>support - binds generated storable with a storage layer
public S instantiate(RawSupport<S> support,
byte[] key,
byte[] value)
throws FetchException
StorableCodecRawSupport can be supplied to the instance.
instantiate in interface StorableCodec<S extends Storable>support - binds generated storable with a storage layer
FetchExceptionpublic byte[] encodePrimaryKey(S storable)
StorableCodec
encodePrimaryKey in interface StorableCodec<S extends Storable>storable - extract primary key properties from this instance
public byte[] encodePrimaryKey(Object[] values)
StorableCodec
encodePrimaryKey in interface StorableCodec<S extends Storable>values - values to build into a key. It must be long enough to
accommodate all primary key properties.
public RawSupport<S> getSupport()
StorableCodecRawSupport object that is supplied to
Storable instances produced by this codec.
getSupport in interface StorableCodec<S extends Storable>public Map<String,? extends StorableProperty<S>> getAllProperties()
public StorableIndex<S> buildPkIndex(String... propertyNames)
public abstract void decodePrimaryKey(S storable,
byte[] bytes)
throws CorruptEncodingException
CorruptEncodingExceptionpublic abstract byte[] encodeData(S storable)
public abstract void decodeData(S storable,
byte[] bytes)
throws CorruptEncodingException
CorruptEncodingException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||