diff options
Diffstat (limited to 'src/main/java/com/amazon/carbonado/info')
-rw-r--r-- | src/main/java/com/amazon/carbonado/info/StorableIntrospector.java | 23 |
1 files changed, 8 insertions, 15 deletions
diff --git a/src/main/java/com/amazon/carbonado/info/StorableIntrospector.java b/src/main/java/com/amazon/carbonado/info/StorableIntrospector.java index 133e175..b7f7744 100644 --- a/src/main/java/com/amazon/carbonado/info/StorableIntrospector.java +++ b/src/main/java/com/amazon/carbonado/info/StorableIntrospector.java @@ -62,7 +62,6 @@ import com.amazon.carbonado.Nullable; import com.amazon.carbonado.Independent;
import com.amazon.carbonado.PrimaryKey;
import com.amazon.carbonado.Query;
-import com.amazon.carbonado.Repository;
import com.amazon.carbonado.Sequence;
import com.amazon.carbonado.Storable;
import com.amazon.carbonado.Version;
@@ -491,35 +490,29 @@ public class StorableIntrospector { checkTypeParameter(errorMessages, type);
- // If type is a class, it must have a public/protected constructor that
- // takes no arguments or a Repository. If overloaded, the constructor
- // with the Repository parameter is preferred by the code generator.
+ // If type is a class, it must have a public or protected no-arg
+ // constructor.
if (!type.isInterface()) {
Constructor[] ctors = type.getDeclaredConstructors();
findCtor: {
for (Constructor c : ctors) {
- modifiers = c.getModifiers();
- if (!Modifier.isPublic(modifiers) && !Modifier.isProtected(modifiers)) {
- continue;
- }
if (c.getParameterTypes().length == 0) {
- break findCtor;
- }
- if (c.getParameterTypes().length == 1) {
- if (c.getParameterTypes()[0] == Repository.class) {
- break findCtor;
+ modifiers = c.getModifiers();
+ if (!Modifier.isPublic(modifiers) && !Modifier.isProtected(modifiers)) {
+ errorMessages.add("Cannot call constructor: " + c);
}
+ break findCtor;
}
}
if (type.getEnclosingClass() == null) {
errorMessages.add
("Class must have a public or protected constructor " +
- "that takes no arguments or a Repository");
+ "that accepts no arguments");
} else {
errorMessages.add
("Inner class must have a public or protected constructor " +
- "that takes no arguments or a Repository");
+ "that accepts no arguments");
}
}
}
|