diff options
author | Brian S. O'Neill <bronee@gmail.com> | 2007-08-14 17:09:20 +0000 |
---|---|---|
committer | Brian S. O'Neill <bronee@gmail.com> | 2007-08-14 17:09:20 +0000 |
commit | b956b6fde3a1a3e485956f1075412fa8a52e8fe9 (patch) | |
tree | d9dccf9d2dff11e382090552528f3caddf7f198e /src/main/java/com/amazon/carbonado/gen | |
parent | a4aa08342e5afe143df42a641a23efd24a0cafb0 (diff) |
Removed support for Storable definition to accept Repository in constructor.
Diffstat (limited to 'src/main/java/com/amazon/carbonado/gen')
-rw-r--r-- | src/main/java/com/amazon/carbonado/gen/StorableGenerator.java | 46 |
1 files changed, 4 insertions, 42 deletions
diff --git a/src/main/java/com/amazon/carbonado/gen/StorableGenerator.java b/src/main/java/com/amazon/carbonado/gen/StorableGenerator.java index 41ba8b9..388b52a 100644 --- a/src/main/java/com/amazon/carbonado/gen/StorableGenerator.java +++ b/src/main/java/com/amazon/carbonado/gen/StorableGenerator.java @@ -21,9 +21,7 @@ package com.amazon.carbonado.gen; import java.lang.annotation.Annotation;
import java.lang.ref.Reference;
import java.lang.ref.SoftReference;
-import java.lang.reflect.Constructor;
import java.lang.reflect.Method;
-import java.lang.reflect.Modifier;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.LinkedHashMap;
@@ -451,8 +449,8 @@ public final class StorableGenerator<S extends Storable> { final int supportParam = 0;
MethodInfo mi = mClassFile.addConstructor(Modifiers.PROTECTED, params);
CodeBuilder b = new CodeBuilder(mi);
-
- addInvokeSuperConstructor(b, supportParam);
+ b.loadThis();
+ b.invokeSuperConstructor(null);
//// this.support = support
b.loadThis();
@@ -468,8 +466,8 @@ public final class StorableGenerator<S extends Storable> { final int wrappedStorableParam = 1;
MethodInfo mi = mClassFile.addConstructor(Modifiers.PUBLIC, params);
CodeBuilder b = new CodeBuilder(mi);
-
- addInvokeSuperConstructor(b, wrappedSupportParam);
+ b.loadThis();
+ b.invokeSuperConstructor(null);
//// this.wrappedSupport = wrappedSupport
b.loadThis();
@@ -1962,42 +1960,6 @@ public final class StorableGenerator<S extends Storable> { }
/**
- * Generates code to invoke super class constructor with no arguments or a
- * Repository.
- */
- private void addInvokeSuperConstructor(CodeBuilder b, final int supportParam) {
- // Look for constructor that accepts a Repository.
-
- boolean passRepo = false;
- {
- for (Constructor c : mStorableType.getDeclaredConstructors()) {
- int modifiers = c.getModifiers();
- if (!Modifier.isPublic(modifiers) && !Modifier.isProtected(modifiers)) {
- continue;
- }
- if (c.getParameterTypes().length == 1) {
- if (c.getParameterTypes()[0] == Repository.class) {
- passRepo = true;
- break;
- }
- }
- }
- }
-
- b.loadThis();
-
- if (passRepo) {
- b.loadLocal(b.getParameter(supportParam));
- b.invokeInterface(StorableSupport.class.getName(), "getRootRepository",
- TypeDesc.forClass(Repository.class), null);
- b.invokeSuperConstructor(new TypeDesc[] {TypeDesc.forClass(Repository.class)});
- } else {
- // Assume no-arg constructor.
- b.invokeSuperConstructor(null);
- }
- }
-
- /**
* If GEN_WRAPPED, generates a method implementation which delgates to the
* WrappedSupport. Also clears join property state if called method
* returns normally.
|