cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kmen...@apache.org
Subject svn commit: r616607 - /cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/
Date Wed, 30 Jan 2008 03:41:50 GMT
Author: kmenard
Date: Tue Jan 29 19:41:48 2008
New Revision: 616607

URL: http://svn.apache.org/viewvc?rev=616607&view=rev
Log:
Generics.

Modified:
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/DbGeneratorPostprocessor.java
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/DbLoader.java
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/FlattenedArcKey.java
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/IncrementalFaultList.java
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/ObjectDiff.java
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/ObjectResolver.java
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/ObjectStore.java
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/ObjectStoreGraphDiff.java
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/ObjectTreeResolver.java
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/PrefetchProcessorJointNode.java

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/DbGeneratorPostprocessor.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/DbGeneratorPostprocessor.java?rev=616607&r1=616606&r2=616607&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/DbGeneratorPostprocessor.java
(original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/DbGeneratorPostprocessor.java
Tue Jan 29 19:41:48 2008
@@ -37,10 +37,10 @@
  */
 class DbGeneratorPostprocessor {
 
-    private static final Map postprocessors;
+    private static final Map<String, HSQLDBPostprocessor> postprocessors;
 
     static {
-        postprocessors = new HashMap();
+        postprocessors = new HashMap<String, HSQLDBPostprocessor>();
         postprocessors.put(HSQLDBAdapter.class.getName(), new HSQLDBPostprocessor());
     }
 
@@ -49,7 +49,7 @@
         DbAdapter adapter = AutoAdapter.getDefaultFactory().createAdapter(
                 connection.getMetaData());
         if (adapter != null) {
-            Postprocessor postprocessor = (Postprocessor) postprocessors.get(adapter
+            Postprocessor postprocessor = postprocessors.get(adapter
                     .getClass()
                     .getName());
             if (postprocessor != null) {

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/DbLoader.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/DbLoader.java?rev=616607&r1=616606&r2=616607&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/DbLoader.java
(original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/DbLoader.java
Tue Jan 29 19:41:48 2008
@@ -67,7 +67,7 @@
 
     // TODO: remove this hardcoded stuff once delegate starts to support procedure
     // loading...
-    private static final Collection EXCLUDED_PROCEDURES = Arrays.asList(
+    private static final Collection<String> EXCLUDED_PROCEDURES = Arrays.asList(
             "auto_pk_for_table", "auto_pk_for_table;1" /*
                                                          * the last name is some Mac OS X
                                                          * Sybase artifact
@@ -77,13 +77,13 @@
     public static final String WILDCARD = "%";
 
     /** List of db entities to process. */
-    private List dbEntityList = new ArrayList();
+    private List<DbEntity> dbEntityList = new ArrayList<DbEntity>();
     
     /**
      * CAY-479 - need to track which entities are skipped in 
      * the loader so that relationships to non-skipped entities can be loaded 
      */
-    private Set skippedEntities = new HashSet();
+    private Set<DbEntity> skippedEntities = new HashSet<DbEntity>();
 
     /** Creates default name for loaded relationship */
     private static String defaultRelName(String dstName, boolean toMany) {
@@ -171,8 +171,8 @@
      * 
      * @return List with the catalog names, empty Array if none found.
      */
-    public List getCatalogs() throws SQLException {
-        List catalogs = new ArrayList();
+    public List<String> getCatalogs() throws SQLException {
+        List<String> catalogs = new ArrayList<String>();
         ResultSet rs = getMetaData().getCatalogs();
 
         try {
@@ -192,8 +192,8 @@
      * 
      * @return List with the schema names, empty Array if none found.
      */
-    public List getSchemas() throws SQLException {
-        List schemas = new ArrayList();
+    public List<String> getSchemas() throws SQLException {
+        List<String> schemas = new ArrayList<String>();
         ResultSet rs = getMetaData().getSchemas();
 
         try {
@@ -214,8 +214,8 @@
      * 
      * @return List of Strings, empty array if nothing found.
      */
-    public List getTableTypes() throws SQLException {
-        List types = new ArrayList();
+    public List<String> getTableTypes() throws SQLException {
+        List<String> types = new ArrayList<String>();
         ResultSet rs = getMetaData().getTableTypes();
 
         try {
@@ -239,13 +239,13 @@
      * @param types The types of table names to retrieve, null returns all types.
      * @return List of TableInfo objects, empty array if nothing found.
      */
-    public List getTables(
+    public List<Table> getTables(
             String catalog,
             String schemaPattern,
             String tableNamePattern,
             String[] types) throws SQLException {
 
-        List tables = new ArrayList();
+        List<Table> tables = new ArrayList<Table>();
 
         if (logObj.isDebugEnabled()) {
             logObj.debug("Read tables: catalog="
@@ -303,12 +303,12 @@
      *            DbEntities must be created.
      * @return false if loading must be immediately aborted.
      */
-    public boolean loadDbEntities(DataMap map, List tables) throws SQLException {
-        this.dbEntityList = new ArrayList();
+    public boolean loadDbEntities(DataMap map, List<? extends Table> tables) throws
SQLException {
+        this.dbEntityList = new ArrayList<DbEntity>();
 
-        Iterator iter = tables.iterator();
+        Iterator<? extends Table> iter = tables.iterator();
         while (iter.hasNext()) {
-            Table table = (Table) iter.next();
+            Table table = iter.next();
 
             // Check if there already is a DbEntity under such name
             // if so, consult the delegate what to do
@@ -419,9 +419,9 @@
         }
         
         // get primary keys for each table and store it in dbEntity
-        Iterator i = map.getDbEntities().iterator();
+        Iterator<DbEntity> i = map.getDbEntities().iterator();
         while (i.hasNext()) {
-            DbEntity dbEntity = (DbEntity) i.next();
+            DbEntity dbEntity = i.next();
             String tableName = dbEntity.getName();
             ResultSet rs = metaData.getPrimaryKeys(null, dbEntity.getSchema(), tableName);
 
@@ -447,10 +447,10 @@
         }
         
         // cay-479 - iterate skipped DbEntities to populate exported keys
-        Iterator skippedEntityIter = skippedEntities.iterator();
+        Iterator<DbEntity> skippedEntityIter = skippedEntities.iterator();
         while (skippedEntityIter.hasNext()) {
 
-            DbEntity skippedEntity = (DbEntity) skippedEntityIter.next();
+            DbEntity skippedEntity = skippedEntityIter.next();
             loadDbRelationships(skippedEntity, map);
         }
             
@@ -464,12 +464,12 @@
      */
     public void loadObjEntities(DataMap map) {
 
-        Iterator dbEntities = dbEntityList.iterator();
+        Iterator<DbEntity> dbEntities = dbEntityList.iterator();
         if (!dbEntities.hasNext()) {
             return;
         }
 
-        List loadedEntities = new ArrayList(dbEntityList.size());
+        List<ObjEntity> loadedEntities = new ArrayList<ObjEntity>(dbEntityList.size());
 
         String packageName = map.getDefaultPackage();
         if (Util.isEmptyString(packageName)) {
@@ -481,10 +481,10 @@
 
         // load empty ObjEntities for all the tables
         while (dbEntities.hasNext()) {
-            DbEntity dbEntity = (DbEntity) dbEntities.next();
+            DbEntity dbEntity = dbEntities.next();
 
             // check if there are existing entities
-            Collection existing = map.getMappedEntities(dbEntity);
+            Collection<ObjEntity> existing = map.getMappedEntities(dbEntity);
             if (existing.size() > 0) {
                 loadedEntities.addAll(existing);
                 continue;
@@ -521,9 +521,9 @@
 
     /** Loads database relationships into a DataMap. */
     public void loadDbRelationships(DataMap map) throws SQLException {
-        Iterator it = dbEntityList.iterator();
+        Iterator<DbEntity> it = dbEntityList.iterator();
         while (it.hasNext()) {
-            DbEntity pkEntity = (DbEntity) it.next();
+            DbEntity pkEntity = it.next();
             loadDbRelationships(pkEntity, map);
         }
     }
@@ -653,11 +653,11 @@
      */
     protected void postprocessMasterDbRelationship(DbRelationship relationship) {
         boolean toPK = true;
-        List joins = relationship.getJoins();
+        List<DbJoin> joins = relationship.getJoins();
 
-        Iterator joinsIt = joins.iterator();
+        Iterator<DbJoin> joinsIt = joins.iterator();
         while (joinsIt.hasNext()) {
-            DbJoin join = (DbJoin) joinsIt.next();
+            DbJoin join = joinsIt.next();
             if (!join.getTarget().isPrimaryKey()) {
                 toPK = false;
                 break;
@@ -694,7 +694,7 @@
         String tableType = adapter.tableTypeForTable();
 
         // use types that are not null
-        List list = new ArrayList();
+        List<String> list = new ArrayList<String>();
         if (viewType != null) {
             list.add(viewType);
         }
@@ -767,7 +767,7 @@
             String namePattern,
             DataMap dataMap) throws SQLException {
 
-        Map procedures = null;
+        Map<String, Procedure> procedures = null;
 
         // get procedures
         ResultSet rs = getMetaData().getProcedures(null, schemaPattern, namePattern);
@@ -801,7 +801,7 @@
                 }
 
                 if (procedures == null) {
-                    procedures = new HashMap();
+                    procedures = new HashMap<String, Procedure>();
                 }
 
                 procedures.put(procedure.getFullyQualifiedName(), procedure);
@@ -844,7 +844,7 @@
                     logObj.debug("skipping ResultSet column: " + key + "." + columnName);
                 }
 
-                Procedure procedure = (Procedure) procedures.get(key);
+                Procedure procedure = procedures.get(key);
 
                 if (procedure == null) {
                     logObj.info("invalid procedure column, no procedure found: "
@@ -905,11 +905,11 @@
             columnsRS.close();
         }
 
-        Iterator it = procedures.values().iterator();
+        Iterator<Procedure> it = procedures.values().iterator();
         while (it.hasNext()) {
             // overwrite existing procedures...
 
-            Procedure procedure = (Procedure) it.next();
+            Procedure procedure = it.next();
             dataMap.addProcedure(procedure);
         }
     }

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/FlattenedArcKey.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/FlattenedArcKey.java?rev=616607&r1=616606&r2=616607&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/FlattenedArcKey.java
(original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/FlattenedArcKey.java
Tue Jan 29 19:41:48 2008
@@ -86,14 +86,14 @@
      * Returns a join DbEntity for the single-step flattened relationship.
      */
     DbEntity getJoinEntity() {
-        List relList = relationship.getDbRelationships();
+        List<DbRelationship> relList = relationship.getDbRelationships();
         if (relList.size() != 2) {
             throw new CayenneRuntimeException(
                     "Only single-step flattened relationships are supported in this operation:
"
                             + relationship);
         }
 
-        DbRelationship firstDbRel = (DbRelationship) relList.get(0);
+        DbRelationship firstDbRel = relList.get(0);
         return (DbEntity) firstDbRel.getTargetEntity();
     }
 
@@ -102,8 +102,8 @@
      * generating value for the primary key column if it is not propagated via the
      * relationships.
      */
-    Map buildJoinSnapshotForInsert(DataNode node) {
-        Map snapshot = lazyJoinSnapshot();
+    Map<String, Object> buildJoinSnapshotForInsert(DataNode node) {
+        Map<String, Object> snapshot = lazyJoinSnapshot();
 
         boolean autoPkDone = false;
         DbEntity joinEntity = getJoinEntity();
@@ -236,15 +236,15 @@
 
     private Map eagerJoinSnapshot() {
 
-        List relList = relationship.getDbRelationships();
+        List<DbRelationship> relList = relationship.getDbRelationships();
         if (relList.size() != 2) {
             throw new CayenneRuntimeException(
                     "Only single-step flattened relationships are supported in this operation:
"
                             + relationship);
         }
 
-        DbRelationship firstDbRel = (DbRelationship) relList.get(0);
-        DbRelationship secondDbRel = (DbRelationship) relList.get(1);
+        DbRelationship firstDbRel = relList.get(0);
+        DbRelationship secondDbRel = relList.get(1);
 
         Map<String, ?> sourceId = this.sourceId.getIdSnapshot();
         Map<String, ?> destinationId = this.destinationId.getIdSnapshot();
@@ -261,32 +261,32 @@
         return snapshot;
     }
 
-    private Map lazyJoinSnapshot() {
+    private Map<String, Object> lazyJoinSnapshot() {
 
-        List relList = relationship.getDbRelationships();
+        List<DbRelationship> relList = relationship.getDbRelationships();
         if (relList.size() != 2) {
             throw new CayenneRuntimeException(
                     "Only single-step flattened relationships are supported in this operation:
"
                             + relationship);
         }
 
-        DbRelationship firstDbRel = (DbRelationship) relList.get(0);
-        DbRelationship secondDbRel = (DbRelationship) relList.get(1);
+        DbRelationship firstDbRel = relList.get(0);
+        DbRelationship secondDbRel = relList.get(1);
 
-        List fromSourceJoins = firstDbRel.getJoins();
-        List toTargetJoins = secondDbRel.getJoins();
+        List<DbJoin> fromSourceJoins = firstDbRel.getJoins();
+        List<DbJoin> toTargetJoins = secondDbRel.getJoins();
 
-        Map snapshot = new HashMap(fromSourceJoins.size() + toTargetJoins.size(), 1);
+        Map<String, Object> snapshot = new HashMap<String, Object>(fromSourceJoins.size()
+ toTargetJoins.size(), 1);
 
         for (int i = 0, numJoins = fromSourceJoins.size(); i < numJoins; i++) {
-            DbJoin join = (DbJoin) fromSourceJoins.get(i);
+            DbJoin join = fromSourceJoins.get(i);
 
             Object value = new PropagatedValueFactory(sourceId, join.getSourceName());
             snapshot.put(join.getTargetName(), value);
         }
 
         for (int i = 0, numJoins = toTargetJoins.size(); i < numJoins; i++) {
-            DbJoin join = (DbJoin) toTargetJoins.get(i);
+            DbJoin join = toTargetJoins.get(i);
             Object value = new PropagatedValueFactory(destinationId, join.getTargetName());
             snapshot.put(join.getSourceName(), value);
         }

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/IncrementalFaultList.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/IncrementalFaultList.java?rev=616607&r1=616606&r2=616607&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/IncrementalFaultList.java
(original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/IncrementalFaultList.java
Tue Jan 29 19:41:48 2008
@@ -382,7 +382,7 @@
                 buf.append("Expected ").append(ids.size()).append(", fetched ").append(
                         objects.size());
 
-                Iterator idsIt = ids.iterator();
+                Iterator<Object> idsIt = ids.iterator();
                 boolean first = true;
                 while (idsIt.hasNext()) {
                     boolean found = false;

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/ObjectDiff.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/ObjectDiff.java?rev=616607&r1=616606&r2=616607&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/ObjectDiff.java
(original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/ObjectDiff.java
Tue Jan 29 19:41:48 2008
@@ -54,12 +54,12 @@
 
     private transient ClassDescriptor classDescriptor;
 
-    private Collection otherDiffs;
+    private Collection<GraphDiff> otherDiffs;
 
-    private Map snapshot;
-    private Map arcSnapshot;
-    private Map currentArcSnapshot;
-    private Map flatIds;
+    private Map<String, Object> snapshot;
+    private Map<String, Object> arcSnapshot;
+    private Map<String, Object> currentArcSnapshot;
+    private Map<ArcOperation, ArcOperation> flatIds;
 
     private Persistent object;
 
@@ -87,8 +87,8 @@
             ObjEntity entity = entityResolver.getObjEntity(entityName);
             final boolean lock = entity.getLockType() == ObjEntity.LOCK_TYPE_OPTIMISTIC;
 
-            this.snapshot = new HashMap();
-            this.arcSnapshot = new HashMap();
+            this.snapshot = new HashMap<String, Object>();
+            this.arcSnapshot = new HashMap<String, Object>();
 
             classDescriptor.visitProperties(new PropertyVisitor() {
 
@@ -208,10 +208,10 @@
                 if (relationship.isFlattened()) {
 
                     if (flatIds == null) {
-                        flatIds = new HashMap();
+                        flatIds = new HashMap<ArcOperation, ArcOperation>();
                     }
 
-                    ArcOperation oldOp = (ArcOperation) flatIds.put(arcDiff, arcDiff);
+                    ArcOperation oldOp = flatIds.put(arcDiff, arcDiff);
 
                     // "delete" cancels "create" and vice versa...
                     if (oldOp != null && oldOp.isDelete() != arcDiff.isDelete())
{
@@ -227,7 +227,7 @@
             else if (property instanceof ToOneProperty) {
 
                 if (currentArcSnapshot == null) {
-                    currentArcSnapshot = new HashMap();
+                    currentArcSnapshot = new HashMap<String, Object>();
                 }
 
                 currentArcSnapshot.put(arcId, targetId);
@@ -242,7 +242,7 @@
 
         if (addDiff) {
             if (otherDiffs == null) {
-                otherDiffs = new ArrayList(3);
+                otherDiffs = new ArrayList<GraphDiff>(3);
             }
 
             otherDiffs.add(diff);
@@ -325,9 +325,9 @@
     public void apply(final GraphChangeHandler handler) {
 
         if (otherDiffs != null) {
-            Iterator it = otherDiffs.iterator();
+            Iterator<GraphDiff> it = otherDiffs.iterator();
             while (it.hasNext()) {
-                ((GraphDiff) it.next()).apply(handler);
+                (it.next()).apply(handler);
             }
         }
 
@@ -384,7 +384,7 @@
      */
     void updateArcSnapshot(String propertyName, Persistent object) {
         if (arcSnapshot == null) {
-            arcSnapshot = new HashMap();
+            arcSnapshot = new HashMap<String, Object>();
         }
 
         arcSnapshot.put(propertyName, object != null ? object.getObjectId() : null);

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/ObjectResolver.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/ObjectResolver.java?rev=616607&r1=616606&r2=616607&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/ObjectResolver.java
(original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/ObjectResolver.java
Tue Jan 29 19:41:48 2008
@@ -96,7 +96,7 @@
     /**
      * Properly synchronized version of 'objectsFromDataRows'.
      */
-    List synchronizedObjectsFromDataRows(List rows) {
+    List<Persistent> synchronizedObjectsFromDataRows(List rows) {
         synchronized (context.getObjectStore()) {
             return objectsFromDataRows(rows);
         }
@@ -109,12 +109,12 @@
      * and DataRowStore.
      * </p>
      */
-    List objectsFromDataRows(List rows) {
+    List<Persistent> objectsFromDataRows(List rows) {
         if (rows == null || rows.size() == 0) {
-            return new ArrayList(1);
+            return new ArrayList<Persistent>(1);
         }
 
-        List results = new ArrayList(rows.size());
+        List<Persistent> results = new ArrayList<Persistent>(rows.size());
         Iterator it = rows.iterator();
 
         while (it.hasNext()) {
@@ -137,9 +137,9 @@
      * and DataRowStore.
      * </p>
      */
-    List relatedObjectsFromDataRows(List rows, PrefetchProcessorNode node) {
+    List<Persistent> relatedObjectsFromDataRows(List rows, PrefetchProcessorNode node)
{
         if (rows == null || rows.size() == 0) {
-            return new ArrayList(1);
+            return new ArrayList<Persistent>(1);
         }
 
         ObjEntity sourceObjEntity = (ObjEntity) node
@@ -152,7 +152,7 @@
                 .getReverseDbRelationshipPath()
                 + ".";
 
-        List results = new ArrayList(rows.size());
+        List<Persistent> results = new ArrayList<Persistent>(rows.size());
         Iterator it = rows.iterator();
 
         while (it.hasNext()) {
@@ -292,10 +292,10 @@
 
         // ... handle generic case - PK.size > 1
 
-        Map idMap = new HashMap(pk.size() * 2);
-        Iterator it = pk.iterator();
+        Map<String, Object> idMap = new HashMap<String, Object>(pk.size() * 2);
+        Iterator<DbAttribute> it = pk.iterator();
         while (it.hasNext()) {
-            DbAttribute attribute = (DbAttribute) it.next();
+            DbAttribute attribute = it.next();
 
             String key = (prefix) ? namePrefix + attribute.getName() : attribute
                     .getName();

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/ObjectStore.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/ObjectStore.java?rev=616607&r1=616606&r2=616607&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/ObjectStore.java
(original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/ObjectStore.java
Tue Jan 29 19:41:48 2008
@@ -296,7 +296,7 @@
             return;
         }
 
-        Collection ids = new ArrayList(objects.size());
+        Collection<ObjectId> ids = new ArrayList<ObjectId>(objects.size());
 
         Iterator it = objects.iterator();
         while (it.hasNext()) {
@@ -600,8 +600,8 @@
      * Return a subset of registered objects that are in a certian persistence state.
      * Collection is returned by copy.
      */
-    public synchronized List objectsInState(int state) {
-        List filteredObjects = new ArrayList();
+    public synchronized List<Persistent> objectsInState(int state) {
+        List<Persistent> filteredObjects = new ArrayList<Persistent>();
 
         Iterator it = objectMap.values().iterator();
         while (it.hasNext()) {

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/ObjectStoreGraphDiff.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/ObjectStoreGraphDiff.java?rev=616607&r1=616606&r2=616607&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/ObjectStoreGraphDiff.java
(original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/ObjectStoreGraphDiff.java
Tue Jan 29 19:41:48 2008
@@ -148,14 +148,14 @@
         if (resolvedDiff == null) {
 
             CompoundDiff diff = new CompoundDiff();
-            Map changes = getChangesByObjectId();
+            Map<Object, ObjectDiff> changes = getChangesByObjectId();
 
             if (!changes.isEmpty()) {
                 List allChanges = new ArrayList(changes.size() * 2);
 
-                Iterator it = changes.values().iterator();
+                Iterator<ObjectDiff> it = changes.values().iterator();
                 while (it.hasNext()) {
-                    ((ObjectDiff) it.next()).appendDiffs(allChanges);
+                    (it.next()).appendDiffs(allChanges);
                 }
 
                 Collections.sort(allChanges);
@@ -184,7 +184,7 @@
                 if (!id.equals(objectId)) {
 
                     if (objectId != null) {
-                        Map replacement = id.getReplacementIdMap();
+                        Map<String, Object> replacement = id.getReplacementIdMap();
                         replacement.clear();
                         replacement.putAll(objectId.getIdSnapshot());
                     }

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/ObjectTreeResolver.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/ObjectTreeResolver.java?rev=616607&r1=616606&r2=616607&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/ObjectTreeResolver.java
(original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/ObjectTreeResolver.java
Tue Jan 29 19:41:48 2008
@@ -100,7 +100,7 @@
     final class TreeBuilder implements PrefetchProcessor {
 
         PrefetchProcessorNode root;
-        LinkedList nodeStack;
+        LinkedList<PrefetchProcessorNode> nodeStack;
 
         List mainResultRows;
         Map extraResultsByPath;
@@ -112,7 +112,7 @@
 
         PrefetchProcessorNode buildTree(PrefetchTreeNode tree) {
             // reset state
-            this.nodeStack = new LinkedList();
+            this.nodeStack = new LinkedList<PrefetchProcessorNode>();
             this.root = null;
 
             tree.traverse(this);
@@ -238,7 +238,7 @@
         }
 
         PrefetchProcessorNode getParent() {
-            return (nodeStack.isEmpty()) ? null : (PrefetchProcessorNode) nodeStack
+            return (nodeStack.isEmpty()) ? null : nodeStack
                     .getLast();
         }
     }

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/PrefetchProcessorJointNode.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/PrefetchProcessorJointNode.java?rev=616607&r1=616606&r2=616607&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/PrefetchProcessorJointNode.java
(original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/PrefetchProcessorJointNode.java
Tue Jan 29 19:41:48 2008
@@ -52,8 +52,8 @@
     ColumnDescriptor[] columns;
     int[] idIndices;
     int rowCapacity;
-    Map resolved;
-    List resolvedRows;
+    Map<Map, Persistent> resolved;
+    List<DataRow> resolvedRows;
 
     PrefetchProcessorJointNode(PrefetchTreeNode parent, String segmentPath) {
         super(parent, segmentPath);
@@ -73,13 +73,13 @@
         }
 
         objects = new ArrayList(capacity);
-        resolved = new HashMap(capacity);
-        resolvedRows = new ArrayList(capacity);
+        resolved = new HashMap<Map, Persistent>(capacity);
+        resolvedRows = new ArrayList<DataRow>(capacity);
         buildRowMapping();
         buildPKIndex();
     }
 
-    List getResolvedRows() {
+    List<DataRow> getResolvedRows() {
         return resolvedRows;
     }
 
@@ -91,13 +91,13 @@
     /**
      * Returns an ObjectId map from the flat row.
      */
-    Map idFromFlatRow(DataRow flatRow) {
+    Map<String, Object> idFromFlatRow(DataRow flatRow) {
 
         // TODO: should we also check for nulls in ID (and skip such rows) - this will
         // likely be an indicator of an outer join ... and considering SQLTemplate,
         // this is reasonable to expect...
 
-        Map id = new TreeMap();
+        Map<String, Object> id = new TreeMap<String, Object>();
         for (int idIndex : idIndices) {
             Object value = flatRow.get(columns[idIndex].getLabel());
             id.put(columns[idIndex].getName(), value);
@@ -111,7 +111,7 @@
      * if no matching object exists.
      */
     Persistent getResolved(Map id) {
-        return (Persistent) resolved.get(id);
+        return resolved.get(id);
     }
 
     /**
@@ -143,7 +143,7 @@
      * Configures row columns mapping for this node entity.
      */
     private void buildRowMapping() {
-        Map targetSource = new TreeMap();
+        Map<String, ColumnDescriptor> targetSource = new TreeMap<String, ColumnDescriptor>();
 
         // build a DB path .. find parent node that terminates the joint group...
         PrefetchTreeNode jointRoot = this;
@@ -228,8 +228,8 @@
         targetSource.values().toArray(columns);
     }
 
-    private ColumnDescriptor appendColumn(Map map, String name, String label) {
-        ColumnDescriptor column = (ColumnDescriptor) map.get(name);
+    private ColumnDescriptor appendColumn(Map<String, ColumnDescriptor> map, String
name, String label) {
+        ColumnDescriptor column = map.get(name);
 
         if (column == null) {
             column = new ColumnDescriptor();



Mime
View raw message