diff options
Diffstat (limited to 'src/main/java/com/amazon/carbonado/raw')
3 files changed, 70 insertions, 117 deletions
diff --git a/src/main/java/com/amazon/carbonado/raw/GenericEncodingStrategy.java b/src/main/java/com/amazon/carbonado/raw/GenericEncodingStrategy.java index e7a8ff9..c5417c4 100644 --- a/src/main/java/com/amazon/carbonado/raw/GenericEncodingStrategy.java +++ b/src/main/java/com/amazon/carbonado/raw/GenericEncodingStrategy.java @@ -25,7 +25,6 @@ import java.math.BigInteger; import java.util.ArrayList;
import java.util.Arrays;
-import java.util.EnumSet;
import java.util.List;
import java.util.Map;
@@ -69,26 +68,6 @@ import com.amazon.carbonado.info.StorablePropertyAdapter; * @author Brian S O'Neill
*/
public class GenericEncodingStrategy<S extends Storable> {
- /**
- * Defines extra encoding options.
- *
- * @since 1.2
- */
- public static enum Option {
- /**
- * Access properties by public methods instead of protected fields.
- * Option should be used if class being generated doesn't have access
- * to these fields.
- */
- USE_METHODS,
-
- /**
- * Property values such as BigDecimal are normalized before being
- * encoded.
- */
- NORMALIZE,
- }
-
private static enum Mode { KEY, DATA, SERIAL }
private final Class<S> mType;
@@ -165,7 +144,9 @@ public class GenericEncodingStrategy<S extends Storable> { * of a Storable instance.
* @param adapterInstanceClass class containing static references to
* adapter instances - defaults to instanceVar
- * @param options optional encoding options
+ * @param useReadMethods when true, access properties by public read
+ * methods instead of protected fields - should be used if class being
+ * generated doesn't have access to these fields
* @param partialStartVar optional variable for supporting partial key
* generation. It must be an int, whose runtime value must be less than the
* properties array length. It marks the range start of the partial
@@ -186,7 +167,7 @@ public class GenericEncodingStrategy<S extends Storable> { OrderedProperty<S>[] properties,
LocalVariable instanceVar,
Class<?> adapterInstanceClass,
- EnumSet<Option> options,
+ boolean useReadMethods,
LocalVariable partialStartVar,
LocalVariable partialEndVar)
throws SupportException
@@ -195,7 +176,7 @@ public class GenericEncodingStrategy<S extends Storable> { return buildEncoding(Mode.KEY, assembler,
extractProperties(properties), extractDirections(properties),
instanceVar, adapterInstanceClass,
- options,
+ useReadMethods,
-1, // no generation support
partialStartVar, partialEndVar);
}
@@ -213,7 +194,9 @@ public class GenericEncodingStrategy<S extends Storable> { * of a Storable instance.
* @param adapterInstanceClass class containing static references to
* adapter instances - defaults to instanceVar
- * @param options optional encoding options
+ * @param useWriteMethods when true, set properties by public write
+ * methods instead of protected fields - should be used if class being
+ * generated doesn't have access to these fields
* @param encodedVar required variable, which must be a byte array. At
* runtime, it references an encoded key.
*
@@ -225,14 +208,14 @@ public class GenericEncodingStrategy<S extends Storable> { OrderedProperty<S>[] properties,
LocalVariable instanceVar,
Class<?> adapterInstanceClass,
- EnumSet<Option> options,
+ boolean useWriteMethods,
LocalVariable encodedVar)
throws SupportException
{
properties = ensureKeyProperties(properties);
buildDecoding(Mode.KEY, assembler,
extractProperties(properties), extractDirections(properties),
- instanceVar, adapterInstanceClass, options,
+ instanceVar, adapterInstanceClass, useWriteMethods,
-1, null, // no generation support
encodedVar);
}
@@ -252,7 +235,8 @@ public class GenericEncodingStrategy<S extends Storable> { * of a Storable instance.
* @param adapterInstanceClass class containing static references to
* adapter instances - defaults to instanceVar
- * @param options optional encoding options
+ * @param useReadMethods when true, access properties by public read
+ * methods instead of protected fields
* @param generation when non-negative, write a storable layout generation
* value in one or four bytes. Generation 0..127 is encoded in one byte, and
* 128..max is encoded in four bytes, with the most significant bit set.
@@ -267,7 +251,7 @@ public class GenericEncodingStrategy<S extends Storable> { StorableProperty<S>[] properties,
LocalVariable instanceVar,
Class<?> adapterInstanceClass,
- EnumSet<Option> options,
+ boolean useReadMethods,
int generation)
throws SupportException
{
@@ -275,7 +259,7 @@ public class GenericEncodingStrategy<S extends Storable> { return buildEncoding(Mode.DATA, assembler,
properties, null,
instanceVar, adapterInstanceClass,
- options, generation, null, null);
+ useReadMethods, generation, null, null);
}
/**
@@ -291,7 +275,9 @@ public class GenericEncodingStrategy<S extends Storable> { * of a Storable instance.
* @param adapterInstanceClass class containing static references to
* adapter instances - defaults to instanceVar
- * @param options optional encoding options
+ * @param useWriteMethods when true, set properties by public write
+ * methods instead of protected fields - should be used if class being
+ * generated doesn't have access to these fields
* @param generation when non-negative, decoder expects a storable layout
* generation value to match this value. Otherwise, it throws a
* CorruptEncodingException.
@@ -311,7 +297,7 @@ public class GenericEncodingStrategy<S extends Storable> { StorableProperty<S>[] properties,
LocalVariable instanceVar,
Class<?> adapterInstanceClass,
- EnumSet<Option> options,
+ boolean useWriteMethods,
int generation,
Label altGenerationHandler,
LocalVariable encodedVar)
@@ -319,7 +305,7 @@ public class GenericEncodingStrategy<S extends Storable> { {
properties = ensureDataProperties(properties);
buildDecoding(Mode.DATA, assembler, properties, null,
- instanceVar, adapterInstanceClass, options,
+ instanceVar, adapterInstanceClass, useWriteMethods,
generation, altGenerationHandler, encodedVar);
}
@@ -330,19 +316,17 @@ public class GenericEncodingStrategy<S extends Storable> { * @param assembler code assembler to receive bytecode instructions
* @param properties specific properties to decode, defaults to all
* properties if null
- * @param options optional encoding options
* @return local variable referencing a byte array with encoded data
* @throws SupportException if any property type is not supported
* @since 1.2
*/
public LocalVariable buildSerialEncoding(CodeAssembler assembler,
- StorableProperty<S>[] properties,
- EnumSet<Option> options)
+ StorableProperty<S>[] properties)
throws SupportException
{
properties = ensureAllProperties(properties);
return buildEncoding
- (Mode.SERIAL, assembler, properties, null, null, null, options, -1, null, null);
+ (Mode.SERIAL, assembler, properties, null, null, null, false, -1, null, null);
}
/**
@@ -352,7 +336,6 @@ public class GenericEncodingStrategy<S extends Storable> { * @param assembler code assembler to receive bytecode instructions
* @param properties specific properties to decode, defaults to all
* properties if null
- * @param options optional encoding options
* @param encodedVar required variable, which must be a byte array. At
* runtime, it references encoded data.
* @throws SupportException if any property type is not supported
@@ -361,13 +344,12 @@ public class GenericEncodingStrategy<S extends Storable> { */
public void buildSerialDecoding(CodeAssembler assembler,
StorableProperty<S>[] properties,
- EnumSet<Option> options,
LocalVariable encodedVar)
throws SupportException
{
properties = ensureAllProperties(properties);
buildDecoding
- (Mode.SERIAL, assembler, properties, null, null, null, options, -1, null, encodedVar);
+ (Mode.SERIAL, assembler, properties, null, null, null, false, -1, null, encodedVar);
}
/**
@@ -636,7 +618,7 @@ public class GenericEncodingStrategy<S extends Storable> { Direction[] directions,
LocalVariable instanceVar,
Class<?> adapterInstanceClass,
- EnumSet<Option> options,
+ boolean useReadMethods,
int generation,
LocalVariable partialStartVar,
LocalVariable partialEndVar)
@@ -715,7 +697,7 @@ public class GenericEncodingStrategy<S extends Storable> { // property is optional, then a byte prefix is needed to
// identify a null reference.
- loadPropertyValue(a, info, 0, options,
+ loadPropertyValue(a, info, 0, useReadMethods,
instanceVar, adapterInstanceClass, partialStartVar);
boolean descending = mode == Mode.KEY
@@ -803,10 +785,7 @@ public class GenericEncodingStrategy<S extends Storable> { hasVariableLength = true;
}
- if (info.getPropertyType() == info.getStorageType() &&
- // BigDecimal is adapted in this method, to strip trailing zeros.
- info.getPropertyType() != TypeDesc.forClass(BigDecimal.class))
- {
+ if (info.getPropertyType() == info.getStorageType()) {
// Property won't be adapted, so loading it twice is no big deal.
continue;
}
@@ -961,7 +940,7 @@ public class GenericEncodingStrategy<S extends Storable> { } else {
// Load property to test for null.
loadPropertyValue(stashedProperties, stashedFromInstances,
- a, info, i, options,
+ a, info, i, useReadMethods,
instanceVar, adapterInstanceClass, partialStartVar);
Label isNull = a.createLabel();
@@ -993,7 +972,7 @@ public class GenericEncodingStrategy<S extends Storable> { propType.toClass() == BigDecimal.class)
{
loadPropertyValue(stashedProperties, stashedFromInstances,
- a, info, i, options,
+ a, info, i, useReadMethods,
instanceVar, adapterInstanceClass, partialStartVar);
String methodName;
@@ -1179,7 +1158,7 @@ public class GenericEncodingStrategy<S extends Storable> { boolean fromInstance = loadPropertyValue
(stashedProperties, stashedFromInstances,
- a, info, i, options,
+ a, info, i, useReadMethods,
instanceVar, adapterInstanceClass, partialStartVar);
TypeDesc propType = info.getStorageType();
@@ -1279,7 +1258,8 @@ public class GenericEncodingStrategy<S extends Storable> { * @param info info for property to load
* @param ordinal zero-based property ordinal, used only if instanceVar
* refers to an object array.
- * @param options optional encoding options
+ * @param useReadMethod when true, access property by public read method
+ * instead of protected field
* @param instanceVar local variable referencing Storable instance,
* defaults to "this" if null. If variable type is an Object array, then
* property values are read from the runtime value of this array instead
@@ -1297,7 +1277,7 @@ public class GenericEncodingStrategy<S extends Storable> { Boolean[] stashedFromInstances,
CodeAssembler a,
StorablePropertyInfo info, int ordinal,
- EnumSet<Option> options,
+ boolean useReadMethod,
LocalVariable instanceVar,
Class<?> adapterInstanceClass,
LocalVariable partialStartVar)
@@ -1308,7 +1288,7 @@ public class GenericEncodingStrategy<S extends Storable> { }
boolean fromInstance = loadPropertyValue
- (a, info, ordinal, options, instanceVar, adapterInstanceClass, partialStartVar);
+ (a, info, ordinal, useReadMethod, instanceVar, adapterInstanceClass, partialStartVar);
if (stashedProperties != null) {
LocalVariable propVar = stashedProperties[ordinal];
@@ -1329,7 +1309,8 @@ public class GenericEncodingStrategy<S extends Storable> { * @param info info for property to load
* @param ordinal zero-based property ordinal, used only if instanceVar
* refers to an object array.
- * @param options optional encoding options
+ * @param useReadMethod when true, access property by public read method
+ * instead of protected field
* @param instanceVar local variable referencing Storable instance,
* defaults to "this" if null. If variable type is an Object array, then
* property values are read from the runtime value of this array instead
@@ -1345,7 +1326,7 @@ public class GenericEncodingStrategy<S extends Storable> { */
protected boolean loadPropertyValue(CodeAssembler a,
StorablePropertyInfo info, int ordinal,
- EnumSet<Option> options,
+ boolean useReadMethod,
LocalVariable instanceVar,
Class<?> adapterInstanceClass,
LocalVariable partialStartVar)
@@ -1356,11 +1337,9 @@ public class GenericEncodingStrategy<S extends Storable> { final boolean isObjectArrayInstanceVar = instanceVar != null
&& instanceVar.getType() == TypeDesc.forClass(Object[].class);
- final boolean useMethod = options != null && options.contains(Option.USE_METHODS);
-
final boolean useAdapterInstance = adapterInstanceClass != null
&& info.getToStorageAdapter() != null
- && (useMethod || isObjectArrayInstanceVar);
+ && (useReadMethod || isObjectArrayInstanceVar);
if (useAdapterInstance) {
// Push adapter instance to stack to be used later.
@@ -1373,7 +1352,7 @@ public class GenericEncodingStrategy<S extends Storable> { if (instanceVar == null) {
a.loadThis();
- if (useMethod) {
+ if (useReadMethod) {
info.addInvokeReadMethod(a);
} else {
// Access property value directly from protected field of "this".
@@ -1386,7 +1365,7 @@ public class GenericEncodingStrategy<S extends Storable> { }
} else if (!isObjectArrayInstanceVar) {
a.loadLocal(instanceVar);
- if (useMethod) {
+ if (useReadMethod) {
info.addInvokeReadMethod(a, instanceVar.getType());
} else {
// Access property value directly from protected field of
@@ -1420,18 +1399,6 @@ public class GenericEncodingStrategy<S extends Storable> { if (useAdapterInstance) {
// Invoke adapter method on instance pushed earlier.
a.invoke(info.getToStorageAdapter());
- } else {
- if (options != null && options.contains(Option.NORMALIZE)) {
- TypeDesc bdType = TypeDesc.forClass(BigDecimal.class);
- if (type == bdType) {
- // Normalize by stripping trailing zeros.
- a.dup();
- Label isNull = a.createLabel();
- a.ifNullBranch(isNull, true);
- a.invokeVirtual(bdType, "stripTrailingZeros", bdType, null);
- isNull.setLocation();
- }
- }
}
return !isObjectArrayInstanceVar;
@@ -1831,7 +1798,7 @@ public class GenericEncodingStrategy<S extends Storable> { Direction[] directions,
LocalVariable instanceVar,
Class<?> adapterInstanceClass,
- EnumSet<Option> options,
+ boolean useWriteMethods,
int generation,
Label altGenerationHandler,
LocalVariable encodedVar)
@@ -1936,7 +1903,7 @@ public class GenericEncodingStrategy<S extends Storable> { // Just store raw property value.
}
- storePropertyValue(a, info, options, instanceVar, adapterInstanceClass);
+ storePropertyValue(a, info, useWriteMethods, instanceVar, adapterInstanceClass);
return;
}
}
@@ -2150,7 +2117,7 @@ public class GenericEncodingStrategy<S extends Storable> { storePropertyLocation.setLocation();
- storePropertyValue(a, info, options, instanceVar, adapterInstanceClass);
+ storePropertyValue(a, info, useWriteMethods, instanceVar, adapterInstanceClass);
nextPropertyLocation.setLocation();
}
@@ -2370,7 +2337,8 @@ public class GenericEncodingStrategy<S extends Storable> { * array must also be on the operand stack.
*
* @param info info for property to store to
- * @param options optional encoding options
+ * @param useWriteMethod when true, set property by public write method
+ * instead of protected field
* @param instanceVar local variable referencing Storable instance,
* defaults to "this" if null. If variable type is an Object array, then
* property values are written to the runtime value of this array instead
@@ -2380,7 +2348,7 @@ public class GenericEncodingStrategy<S extends Storable> { * @see #pushDecodingInstanceVar pushDecodingInstanceVar
*/
protected void storePropertyValue(CodeAssembler a, StorablePropertyInfo info,
- EnumSet<Option> options,
+ boolean useWriteMethod,
LocalVariable instanceVar,
Class<?> adapterInstanceClass) {
TypeDesc type = info.getPropertyType();
@@ -2389,11 +2357,9 @@ public class GenericEncodingStrategy<S extends Storable> { boolean isObjectArrayInstanceVar = instanceVar != null
&& instanceVar.getType() == TypeDesc.forClass(Object[].class);
- final boolean useMethod = options != null && options.contains(Option.USE_METHODS);
-
boolean useAdapterInstance = adapterInstanceClass != null
&& info.getToStorageAdapter() != null
- && (useMethod || isObjectArrayInstanceVar);
+ && (useWriteMethod || isObjectArrayInstanceVar);
if (useAdapterInstance) {
// Push adapter instance to adapt property value. It must be on the
@@ -2416,7 +2382,7 @@ public class GenericEncodingStrategy<S extends Storable> { }
if (instanceVar == null) {
- if (useMethod) {
+ if (useWriteMethod) {
info.addInvokeWriteMethod(a);
} else {
// Set property value directly to protected field of instance.
@@ -2499,7 +2465,7 @@ public class GenericEncodingStrategy<S extends Storable> { return;
}
- if (useMethod) {
+ if (useWriteMethod) {
info.addInvokeWriteMethod(a, instanceVarType);
} else {
// Set property value directly to protected field of referenced
diff --git a/src/main/java/com/amazon/carbonado/raw/GenericStorableCodec.java b/src/main/java/com/amazon/carbonado/raw/GenericStorableCodec.java index 3a642e4..dd43515 100644 --- a/src/main/java/com/amazon/carbonado/raw/GenericStorableCodec.java +++ b/src/main/java/com/amazon/carbonado/raw/GenericStorableCodec.java @@ -21,7 +21,6 @@ package com.amazon.carbonado.raw; import java.lang.ref.WeakReference;
import java.lang.reflect.Method;
import java.lang.reflect.UndeclaredThrowableException;
-import java.util.EnumSet;
import java.util.Map;
import org.cojen.classfile.ClassFile;
@@ -56,8 +55,6 @@ import com.amazon.carbonado.gen.CodeBuilderUtil; import com.amazon.carbonado.util.ThrowUnchecked;
import com.amazon.carbonado.util.QuickConstructorGenerator;
-import static com.amazon.carbonado.raw.GenericEncodingStrategy.Option;
-
/**
* Generic codec that supports any kind of storable by auto-generating and
* caching storable implementations.
@@ -200,17 +197,15 @@ public class GenericStorableCodec<S extends Storable> implements StorableCodec<S // TODO: Consider caching generated key. Rebuild if null or if pk is dirty.
- EnumSet<Option> options = EnumSet.of(Option.NORMALIZE);
-
// assembler = b
// properties = null (defaults to all key properties)
// instanceVar = null (null means "this")
// adapterInstanceClass = null (null means use instanceVar, in this case is "this")
- // options = options
+ // useReadMethods = false (will read fields directly)
// partialStartVar = null (only support encoding all properties)
// partialEndVar = null (only support encoding all properties)
LocalVariable encodedVar =
- encodingStrategy.buildKeyEncoding(b, null, null, null, options, null, null);
+ encodingStrategy.buildKeyEncoding(b, null, null, null, false, null, null);
b.loadLocal(encodedVar);
b.returnValue(byteArrayType);
@@ -224,16 +219,14 @@ public class GenericStorableCodec<S extends Storable> implements StorableCodec<S byteArrayType, null);
CodeBuilder b = new CodeBuilder(mi);
- EnumSet<Option> options = EnumSet.of(Option.NORMALIZE);
-
// assembler = b
// properties = null (defaults to all non-key properties)
// instanceVar = null (null means "this")
// adapterInstanceClass = null (null means use instanceVar, in this case is "this")
- // options = options
+ // useReadMethods = false (will read fields directly)
// generation = generation
LocalVariable encodedVar =
- encodingStrategy.buildDataEncoding(b, null, null, null, options, generation);
+ encodingStrategy.buildDataEncoding(b, null, null, null, false, generation);
b.loadLocal(encodedVar);
b.returnValue(byteArrayType);
@@ -250,9 +243,9 @@ public class GenericStorableCodec<S extends Storable> implements StorableCodec<S // properties = null (defaults to all key properties)
// instanceVar = null (null means "this")
// adapterInstanceClass = null (null means use instanceVar, in this case is "this")
- // options = null (will set fields directly)
+ // useWriteMethods = false (will set fields directly)
// encodedVar = references byte array with encoded key
- encodingStrategy.buildKeyDecoding(b, null, null, null, null, b.getParameter(0));
+ encodingStrategy.buildKeyDecoding(b, null, null, null, false, b.getParameter(0));
b.returnVoid();
}
@@ -269,12 +262,12 @@ public class GenericStorableCodec<S extends Storable> implements StorableCodec<S // properties = null (defaults to all non-key properties)
// instanceVar = null (null means "this")
// adapterInstanceClass = null (null means use instanceVar, in this case is "this")
- // options = null (will set fields directly)
+ // useWriteMethods = false (will set fields directly)
// generation = generation
// altGenerationHandler = altGenerationHandler
// encodedVar = references byte array with encoded data
encodingStrategy.buildDataDecoding
- (b, null, null, null, null, generation, altGenerationHandler, b.getParameter(0));
+ (b, null, null, null, false, generation, altGenerationHandler, b.getParameter(0));
b.returnVoid();
@@ -591,17 +584,15 @@ public class GenericStorableCodec<S extends Storable> implements StorableCodec<S LocalVariable instanceVar = b.createLocalVariable(null, instanceType);
b.storeLocal(instanceVar);
- EnumSet<Option> options = EnumSet.of(Option.NORMALIZE);
-
// assembler = b
// properties = properties to encode
// instanceVar = instanceVar which references storable instance
// adapterInstanceClass = null (null means use instanceVar)
- // options = options
+ // useReadMethods = false (will read fields directly)
// partialStartVar = null (only support encoding all properties)
// partialEndVar = null (only support encoding all properties)
LocalVariable encodedVar = mEncodingStrategy.buildKeyEncoding
- (b, properties, instanceVar, null, options, null, null);
+ (b, properties, instanceVar, null, false, null, null);
b.loadLocal(encodedVar);
b.returnValue(byteArrayType);
@@ -622,17 +613,15 @@ public class GenericStorableCodec<S extends Storable> implements StorableCodec<S LocalVariable instanceVar = b.createLocalVariable(null, instanceType);
b.storeLocal(instanceVar);
- EnumSet<Option> options = EnumSet.of(Option.NORMALIZE);
-
// assembler = b
// properties = properties to encode
// instanceVar = instanceVar which references storable instance
// adapterInstanceClass = null (null means use instanceVar)
- // options = options
+ // useReadMethods = false (will read fields directly)
// partialStartVar = int parameter 1, references start property index
// partialEndVar = int parameter 2, references end property index
LocalVariable encodedVar = mEncodingStrategy.buildKeyEncoding
- (b, properties, instanceVar, null, options, b.getParameter(1), b.getParameter(2));
+ (b, properties, instanceVar, null, false, b.getParameter(1), b.getParameter(2));
b.loadLocal(encodedVar);
b.returnValue(byteArrayType);
@@ -656,17 +645,15 @@ public class GenericStorableCodec<S extends Storable> implements StorableCodec<S new TypeDesc[] {objectArrayType});
CodeBuilder b = new CodeBuilder(mi);
- EnumSet<Option> options = EnumSet.of(Option.NORMALIZE);
-
// assembler = b
// properties = properties to encode
// instanceVar = parameter 0, an object array
// adapterInstanceClass = adapterInstanceClass - see comment above
- // options = options
+ // useReadMethods = false (will read fields directly)
// partialStartVar = null (only support encoding all properties)
// partialEndVar = null (only support encoding all properties)
LocalVariable encodedVar = mEncodingStrategy.buildKeyEncoding
- (b, properties, b.getParameter(0), adapterInstanceClass, options, null, null);
+ (b, properties, b.getParameter(0), adapterInstanceClass, false, null, null);
b.loadLocal(encodedVar);
b.returnValue(byteArrayType);
@@ -683,18 +670,16 @@ public class GenericStorableCodec<S extends Storable> implements StorableCodec<S new TypeDesc[] {objectArrayType, TypeDesc.INT, TypeDesc.INT});
CodeBuilder b = new CodeBuilder(mi);
- EnumSet<Option> options = EnumSet.of(Option.NORMALIZE);
-
// assembler = b
// properties = properties to encode
// instanceVar = parameter 0, an object array
// adapterInstanceClass = adapterInstanceClass - see comment above
- // options = options
+ // useReadMethods = false (will read fields directly)
// partialStartVar = int parameter 1, references start property index
// partialEndVar = int parameter 2, references end property index
LocalVariable encodedVar = mEncodingStrategy.buildKeyEncoding
(b, properties, b.getParameter(0), adapterInstanceClass,
- options, b.getParameter(1), b.getParameter(2));
+ false, b.getParameter(1), b.getParameter(2));
b.loadLocal(encodedVar);
b.returnValue(byteArrayType);
@@ -730,11 +715,11 @@ public class GenericStorableCodec<S extends Storable> implements StorableCodec<S // properties = no parameters - we just want the key prefix
// instanceVar = null (no parameters means we don't need this)
// adapterInstanceClass = null (no parameters means we don't need this)
- // options = null (no parameters means we don't need this)
+ // useReadMethods = false (no parameters means we don't need this)
// partialStartVar = null (no parameters means we don't need this)
// partialEndVar = null (no parameters means we don't need this)
LocalVariable encodedVar = mEncodingStrategy.buildKeyEncoding
- (b, new OrderedProperty[0], null, null, null, null, null);
+ (b, new OrderedProperty[0], null, null, false, null, null);
b.loadLocal(encodedVar);
b.storeStaticField(BLANK_KEY_FIELD_NAME, byteArrayType);
@@ -798,13 +783,13 @@ public class GenericStorableCodec<S extends Storable> implements StorableCodec<S // properties = null (defaults to all non-key properties)
// instanceVar = "dest" storable
// adapterInstanceClass = null (null means use instanceVar, in this case is "dest")
- // options = null (will set fields directly)
+ // useWriteMethods = false (will set fields directly)
// generation = generation
// altGenerationHandler = null (generation should match)
// encodedVar = "data" byte array
try {
altStrategy.buildDataDecoding
- (b, null, destVar, null, null, generation, null, dataVar);
+ (b, null, destVar, null, false, generation, null, dataVar);
} catch (SupportException e) {
throw new CorruptEncodingException(e);
}
diff --git a/src/main/java/com/amazon/carbonado/raw/RawStorableGenerator.java b/src/main/java/com/amazon/carbonado/raw/RawStorableGenerator.java index 57467cc..07f38a7 100644 --- a/src/main/java/com/amazon/carbonado/raw/RawStorableGenerator.java +++ b/src/main/java/com/amazon/carbonado/raw/RawStorableGenerator.java @@ -180,11 +180,13 @@ public class RawStorableGenerator { EnumSet<MasterFeature> features;
if (isMaster) {
features = EnumSet.of(MasterFeature.VERSIONING,
+ MasterFeature.NORMALIZE,
MasterFeature.UPDATE_FULL,
MasterFeature.INSERT_SEQUENCES,
MasterFeature.INSERT_CHECK_REQUIRED);
} else {
- features = EnumSet.of(MasterFeature.UPDATE_FULL);
+ features = EnumSet.of(MasterFeature.NORMALIZE,
+ MasterFeature.UPDATE_FULL);
}
final Class<? extends S> abstractClass =
|