From b956b6fde3a1a3e485956f1075412fa8a52e8fe9 Mon Sep 17 00:00:00 2001 From: "Brian S. O'Neill" Date: Tue, 14 Aug 2007 17:09:20 +0000 Subject: Removed support for Storable definition to accept Repository in constructor. --- .../carbonado/info/StorableIntrospector.java | 23 ++++++++-------------- 1 file changed, 8 insertions(+), 15 deletions(-) (limited to 'src/main/java/com/amazon/carbonado/info') 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"); } } } -- cgit v1.2.3