summaryrefslogtreecommitdiff
path: root/projects/net.wotonomy.persistence/src/main/java/net/wotonomy/access/EOAdaptor.java
diff options
context:
space:
mode:
authorBenjamin Culkin <scorpress@gmail.com>2024-05-20 17:58:16 -0400
committerBenjamin Culkin <scorpress@gmail.com>2024-05-20 17:58:16 -0400
commit40a9d99496e098562f090fb7ffce9e749011b131 (patch)
tree437df24d65470582e943e494a52db8ed65a881ae /projects/net.wotonomy.persistence/src/main/java/net/wotonomy/access/EOAdaptor.java
parentff072dfe782f6f22123cd4ba050828d35c0d0fbd (diff)
Formatting pass
Diffstat (limited to 'projects/net.wotonomy.persistence/src/main/java/net/wotonomy/access/EOAdaptor.java')
-rw-r--r--projects/net.wotonomy.persistence/src/main/java/net/wotonomy/access/EOAdaptor.java81
1 files changed, 44 insertions, 37 deletions
diff --git a/projects/net.wotonomy.persistence/src/main/java/net/wotonomy/access/EOAdaptor.java b/projects/net.wotonomy.persistence/src/main/java/net/wotonomy/access/EOAdaptor.java
index 28295d1..17d6454 100644
--- a/projects/net.wotonomy.persistence/src/main/java/net/wotonomy/access/EOAdaptor.java
+++ b/projects/net.wotonomy.persistence/src/main/java/net/wotonomy/access/EOAdaptor.java
@@ -26,11 +26,11 @@ import net.wotonomy.foundation.NSMutableDictionary;
import net.wotonomy.foundation.NSTimestamp;
/**
-*
-* @author ezamudio@nasoft.com
-* @author $Author: cgruber $
-* @version $Revision: 894 $
-*/
+ *
+ * @author ezamudio@nasoft.com
+ * @author $Author: cgruber $
+ * @version $Revision: 894 $
+ */
public abstract class EOAdaptor {
@@ -48,6 +48,7 @@ public abstract class EOAdaptor {
/**
* Creates an adaptor with model's adaptorName and sets its connection
* dictionary to the model's connection dictionary.
+ *
* @param model The model to take adaptorName and connectionDictionary from.
* @return The adaptor specified in model.
*/
@@ -64,11 +65,13 @@ public abstract class EOAdaptor {
}
/**
- * Instantiates an adaptor of a concrete EOAdaptor subclass, based on name.
- * If name is a fully qualified class name, then it returns an instance of that class
- * by invoking the constructor with a string argument. Otherwise, it
- * tries to find a class called (name)Adaptor in a package called
- * net.wotonomy.(lowercase name)adaptor; if it can't find one, an exception is raised.
+ * Instantiates an adaptor of a concrete EOAdaptor subclass, based on name. If
+ * name is a fully qualified class name, then it returns an instance of that
+ * class by invoking the constructor with a string argument. Otherwise, it tries
+ * to find a class called (name)Adaptor in a package called
+ * net.wotonomy.(lowercase name)adaptor; if it can't find one, an exception is
+ * raised.
+ *
* @param name The name of the adaptor, or a fully qualified class name.
* @return
*/
@@ -78,10 +81,10 @@ public abstract class EOAdaptor {
if (name.endsWith("Adaptor") && name.indexOf('.') > 0) {
cname = name;
int lastdot = name.lastIndexOf('.');
- //take off the package and the 'Adaptor' suffix
+ // take off the package and the 'Adaptor' suffix
name = cname.substring(lastdot, cname.length() - 7);
} else {
- //construct the fully qualified class name
+ // construct the fully qualified class name
cname = "net.wotonomy." + name.toLowerCase() + "adaptor." + name + "Adaptor";
}
try {
@@ -92,12 +95,14 @@ public abstract class EOAdaptor {
EOAdaptor adaptor = null;
java.lang.reflect.Constructor callme = null;
try {
- callme = adaptorClass.getConstructor(new Class[]{ String.class });
- adaptor = (EOAdaptor)callme.newInstance((Object[])new String[]{ name });
+ callme = adaptorClass.getConstructor(new Class[] { String.class });
+ adaptor = (EOAdaptor) callme.newInstance((Object[]) new String[] { name });
} catch (ClassCastException ex) {
- throw new IllegalArgumentException("Class " + adaptorClass.getName() + " must inherit from net.wotonomy.access.EOAdaptor");
- }catch (Exception ex) {
- throw new IllegalArgumentException("Cannot find or invoke constructor with name argument in class " + adaptorClass.getName());
+ throw new IllegalArgumentException(
+ "Class " + adaptorClass.getName() + " must inherit from net.wotonomy.access.EOAdaptor");
+ } catch (Exception ex) {
+ throw new IllegalArgumentException(
+ "Cannot find or invoke constructor with name argument in class " + adaptorClass.getName());
}
return adaptor;
}
@@ -105,8 +110,9 @@ public abstract class EOAdaptor {
public static void setExpressionClassName(String expClassName, String adaptorClassName) {
_expressionClassesByName.setObjectForKey(expClassName, adaptorClassName);
}
+
public static String expressionClassName(String adaptorClassName) {
- return (String)_expressionClassesByName.objectForKey(adaptorClassName);
+ return (String) _expressionClassesByName.objectForKey(adaptorClassName);
}
public void assignExternalInfoForAttribute(EOAttribute attribute) {
@@ -126,11 +132,11 @@ public abstract class EOAdaptor {
public void assignExternalInfoForEntireModel(EOModel model) {
NSArray ents = model.entities();
for (int i = 0; i < ents.count(); i++) {
- EOEntity e = (EOEntity)ents.objectAtIndex(i);
- //TODO: check that entity is not a prototypes entity
+ EOEntity e = (EOEntity) ents.objectAtIndex(i);
+ // TODO: check that entity is not a prototypes entity
NSArray atts = e.attributes();
for (int j = 0; j < atts.count(); j++) {
- EOAttribute a = (EOAttribute)atts.objectAtIndex(i);
+ EOAttribute a = (EOAttribute) atts.objectAtIndex(i);
assignExternalInfoForAttribute(a);
}
assignExternalInfoForEntity(e);
@@ -149,6 +155,7 @@ public abstract class EOAdaptor {
public void setConnectionDictionary(NSDictionary connection) {
_connectionDictionary = connection;
}
+
public NSDictionary connectionDictionary() {
return _connectionDictionary;
}
@@ -205,19 +212,19 @@ public abstract class EOAdaptor {
if (value == NSKeyValueCoding.NullValue)
return value;
if (value instanceof String)
- return fetchedValueForStringValue((String)value, attr);
+ return fetchedValueForStringValue((String) value, attr);
if (value instanceof NSData)
- return fetchedValueForDataValue((NSData)value, attr);
+ return fetchedValueForDataValue((NSData) value, attr);
if (value instanceof Number)
- return fetchedValueForNumberValue((Number)value, attr);
+ return fetchedValueForNumberValue((Number) value, attr);
if (value instanceof NSTimestamp)
- return fetchedValueForDateValue((NSTimestamp)value, attr);
+ return fetchedValueForDateValue((NSTimestamp) value, attr);
return value;
}
public void handleDroppedConnection() {
for (int i = 0; i < _contexts.count(); i++) {
- EOAdaptorContext c = (EOAdaptorContext)_contexts.objectAtIndex(i);
+ EOAdaptorContext c = (EOAdaptorContext) _contexts.objectAtIndex(i);
c.transactionDidRollback();
c.handleDroppedConnection();
}
@@ -226,7 +233,7 @@ public abstract class EOAdaptor {
public boolean hasOpenChannels() {
for (int i = 0; i < _contexts.count(); i++) {
- EOAdaptorContext c = (EOAdaptorContext)_contexts.objectAtIndex(i);
+ EOAdaptorContext c = (EOAdaptorContext) _contexts.objectAtIndex(i);
if (c.hasOpenChannels())
return true;
}
@@ -251,19 +258,19 @@ public abstract class EOAdaptor {
}
/*
- * $Log$
- * Revision 1.2 2006/02/16 16:47:14 cgruber
- * Move some classes in to "internal" packages and re-work imports, etc.
+ * $Log$ Revision 1.2 2006/02/16 16:47:14 cgruber Move some classes in to
+ * "internal" packages and re-work imports, etc.
*
- * Also use UnsupportedOperationExceptions where appropriate, instead of WotonomyExceptions.
+ * Also use UnsupportedOperationExceptions where appropriate, instead of
+ * WotonomyExceptions.
*
- * Revision 1.1 2006/02/16 13:19:57 cgruber
- * Check in all sources in eclipse-friendly maven-enabled packages.
+ * Revision 1.1 2006/02/16 13:19:57 cgruber Check in all sources in
+ * eclipse-friendly maven-enabled packages.
*
- * Revision 1.2 2005/12/08 06:52:32 cgruber
- * Move tests, improve build.xml, and make certain casts explicit so that Java 1.5 doesn't complain about varargs.
+ * Revision 1.2 2005/12/08 06:52:32 cgruber Move tests, improve build.xml, and
+ * make certain casts explicit so that Java 1.5 doesn't complain about varargs.
*
- * Revision 1.1 2003/08/13 00:37:45 chochos
- * an almost complete implementation of the abstract adaptor-layer classes
+ * Revision 1.1 2003/08/13 00:37:45 chochos an almost complete implementation of
+ * the abstract adaptor-layer classes
*
*/ \ No newline at end of file