[jboss-svn-commits] JBL Code SVN: r35838 - labs/jbossrules/trunk/drools-repository/src/main/java/org/drools/repository.

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Tue Nov 2 09:31:42 EDT 2010


Author: ge0ffrey
Date: 2010-11-02 09:31:41 -0400 (Tue, 02 Nov 2010)
New Revision: 35838

Modified:
   labs/jbossrules/trunk/drools-repository/src/main/java/org/drools/repository/RulesRepository.java
Log:
refactoring: use generics to avoid littering the source code with casts

Modified: labs/jbossrules/trunk/drools-repository/src/main/java/org/drools/repository/RulesRepository.java
===================================================================
--- labs/jbossrules/trunk/drools-repository/src/main/java/org/drools/repository/RulesRepository.java	2010-11-02 13:28:54 UTC (rev 35837)
+++ labs/jbossrules/trunk/drools-repository/src/main/java/org/drools/repository/RulesRepository.java	2010-11-02 13:31:41 UTC (rev 35838)
@@ -1207,7 +1207,7 @@
     }
 
     /**
-     * This will rename an assset and apply the change immediately.
+     * This will rename an asset and apply the change immediately.
      * @return the UUID of the new asset
      */
     public String renameAsset(String uuid,
@@ -1314,13 +1314,13 @@
             if ( !snaps.hasNode( packageName ) ) {
                 return new String[0];
             } else {
-                List result = new ArrayList();
+                List<String> result = new ArrayList<String>();
                 NodeIterator it = snaps.getNode( packageName ).getNodes();
                 while ( it.hasNext() ) {
                     Node element = (Node) it.next();
                     result.add( element.getName() );
                 }
-                return (String[]) result.toArray( new String[result.size()] );
+                return result.toArray( new String[result.size()] );
             }
         } catch ( RepositoryException e ) {
             throw new RulesRepositoryException( e );
@@ -1400,8 +1400,6 @@
     /**
      * This will do a general predicate search.
      * @param params - a map of field to a list of possible values (which are or-ed together if there is more then one).
-     * @param position - where to start returning results from.
-     * @param maxRows - maximum number of rows to return;
      * @param seekArchived - include archived stuff in the results.
      */
     public AssetItemIterator query(Map<String, String[]> params,
@@ -1488,7 +1486,7 @@
      * @return A list of statii in the system.
      */
     public StateItem[] listStates() {
-        List states = new ArrayList();
+        List<StateItem> states = new ArrayList<StateItem>();
         NodeIterator it;
         try {
             it = this.getAreaNode( STATE_AREA ).getNodes();
@@ -1501,7 +1499,7 @@
             log.error( e.getMessage(), e );
             throw new RulesRepositoryException( e );
         }
-        return (StateItem[]) states.toArray( new StateItem[states.size()] );
+        return states.toArray( new StateItem[states.size()] );
     }
 
     /**



More information about the jboss-svn-commits mailing list