com.amazon.carbonado.raw
Class RawStorableGenerator

java.lang.Object
  extended by com.amazon.carbonado.raw.RawStorableGenerator

public class RawStorableGenerator
extends Object

Generates and caches abstract implementations of Storable types which are encoded and decoded in a raw format. The generated abstract classes extend those created by MasterStorableGenerator.

Author:
Brian S O'Neill
See Also:
GenericStorableCodec, RawSupport

Field Summary
static String DECODE_DATA_METHOD_NAME
          Name of protected abstract method in generated storable
static String DECODE_KEY_METHOD_NAME
          Name of protected abstract method in generated storable
static String ENCODE_DATA_METHOD_NAME
          Name of protected abstract method in generated storable
static String ENCODE_KEY_METHOD_NAME
          Name of protected abstract method in generated storable
 
Method Summary
static
<S extends Storable>
Class<? extends S>
getAbstractClass(Class<S> type, boolean isMaster)
          Returns an abstract implementation of the given Storable type, which is fully thread-safe.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ENCODE_KEY_METHOD_NAME

public static final String ENCODE_KEY_METHOD_NAME
Name of protected abstract method in generated storable

See Also:
Constant Field Values

DECODE_KEY_METHOD_NAME

public static final String DECODE_KEY_METHOD_NAME
Name of protected abstract method in generated storable

See Also:
Constant Field Values

ENCODE_DATA_METHOD_NAME

public static final String ENCODE_DATA_METHOD_NAME
Name of protected abstract method in generated storable

See Also:
Constant Field Values

DECODE_DATA_METHOD_NAME

public static final String DECODE_DATA_METHOD_NAME
Name of protected abstract method in generated storable

See Also:
Constant Field Values
Method Detail

getAbstractClass

public static <S extends Storable> Class<? extends S> getAbstractClass(Class<S> type,
                                                                       boolean isMaster)
                                                            throws SupportException,
                                                                   IllegalArgumentException
Returns an abstract implementation of the given Storable type, which is fully thread-safe. The Storable type itself may be an interface or a class. If it is a class, then it must not be final, and it must have a public, no-arg constructor. Three constructors are defined for the abstract implementation:
 public <init>(RawSupport);

 public <init>(RawSupport, byte[] key);

 public <init>(RawSupport, byte[] key, byte[] value);
 

Subclasses must implement the following abstract protected methods, whose exact names are defined by constants in this class:

 // Encode the primary key of this storable.
 protected abstract byte[] encodeKey();

 // Encode all properties of this storable excluding the primary key.
 protected abstract byte[] encodeData();

 // Decode the primary key into properties of this storable.
 // Note: this method is also invoked by the three argument constructor.
 protected abstract void decodeKey(byte[]);

 // Decode the data into properties of this storable.
 // Note: this method is also invoked by the three argument constructor.
 protected abstract void decodeData(byte[]);
 

Parameters:
isMaster - when true, version properties, sequences, and triggers are managed
Throws:
IllegalArgumentException - if type is null
SupportException


Copyright © 2006-2009 Amazon Technologies, Inc.. All Rights Reserved.