You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by ra...@apache.org on 2008/12/23 22:14:13 UTC

svn commit: r729122 - in /commons/proper/digester/trunk/src/java/org/apache/commons/digester/plugins: PluginCreateRule.java PluginManager.java PluginRules.java

Author: rahul
Date: Tue Dec 23 13:14:13 2008
New Revision: 729122

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

Modified:
    commons/proper/digester/trunk/src/java/org/apache/commons/digester/plugins/PluginCreateRule.java
    commons/proper/digester/trunk/src/java/org/apache/commons/digester/plugins/PluginManager.java
    commons/proper/digester/trunk/src/java/org/apache/commons/digester/plugins/PluginRules.java

Modified: commons/proper/digester/trunk/src/java/org/apache/commons/digester/plugins/PluginCreateRule.java
URL: http://svn.apache.org/viewvc/commons/proper/digester/trunk/src/java/org/apache/commons/digester/plugins/PluginCreateRule.java?rev=729122&r1=729121&r2=729122&view=diff
==============================================================================
--- commons/proper/digester/trunk/src/java/org/apache/commons/digester/plugins/PluginCreateRule.java (original)
+++ commons/proper/digester/trunk/src/java/org/apache/commons/digester/plugins/PluginCreateRule.java Tue Dec 23 13:14:13 2008
@@ -47,7 +47,7 @@
     private String pattern;
 
     /** A base class that any plugin must derive from. */
-    private Class baseClass = null;
+    private Class<?> baseClass = null;
 
     /**
      * Info about optional default plugin to be used if no plugin-id is
@@ -73,7 +73,7 @@
      * @param baseClass is the class which any specified plugin <i>must</i> be
      * descended from.
      */
-    public PluginCreateRule(Class baseClass) {
+    public PluginCreateRule(Class<?> baseClass) {
         this.baseClass = baseClass;
     }
 
@@ -88,7 +88,7 @@
      * doesn't specify any plugin-class or plugin-id. This class will have
      * custom rules installed for it just like a declared plugin.
      */
-    public PluginCreateRule(Class baseClass, Class dfltPluginClass) {
+    public PluginCreateRule(Class<?> baseClass, Class<?> dfltPluginClass) {
         this.baseClass = baseClass;
         if (dfltPluginClass != null) {
             defaultPlugin = new Declaration(dfltPluginClass);
@@ -108,7 +108,7 @@
      * @param dfltPluginRuleLoader is a RuleLoader instance which knows how
      * to load the custom rules associated with this default plugin.
      */
-    public PluginCreateRule(Class baseClass, Class dfltPluginClass,
+    public PluginCreateRule(Class<?> baseClass, Class<?> dfltPluginClass,
                     RuleLoader dfltPluginRuleLoader) {
 
         this.baseClass = baseClass;
@@ -379,7 +379,7 @@
         }
             
         // get the class of the user plugged-in type
-        Class pluginClass = currDeclaration.getPluginClass();
+        Class<?> pluginClass = currDeclaration.getPluginClass();
         
         String path = digester.getMatch();
 
@@ -413,7 +413,7 @@
         // and now we have to fire any custom rules which would have
         // been matched by the same path that matched this rule, had
         // they been loaded at that time.
-        List rules = newRules.getDecoratedRules().match(namespace, path);
+        List<Rule> rules = newRules.getDecoratedRules().match(namespace, path);
         fireBeginMethods(rules, namespace, name, attributes); 
     }
 
@@ -440,7 +440,7 @@
 
         String path = digester.getMatch();
         PluginRules newRules = (PluginRules) digester.getRules();
-        List rules = newRules.getDecoratedRules().match(namespace, path);
+        List<Rule> rules = newRules.getDecoratedRules().match(namespace, path);
         fireBodyMethods(rules, namespace, name, text);
     }
 
@@ -462,7 +462,7 @@
         // see body method for more info
         String path = digester.getMatch();
         PluginRules newRules = (PluginRules) digester.getRules();
-        List rules = newRules.getDecoratedRules().match(namespace, path);
+        List<Rule> rules = newRules.getDecoratedRules().match(namespace, path);
         fireEndMethods(rules, namespace, name);
         
         // pop the stack of PluginRules instances, which
@@ -496,7 +496,7 @@
      * class provided a way for this functionality to just be invoked
      * directly.
      */
-    public void fireBeginMethods(List rules,
+    public void fireBeginMethods(List<Rule> rules,
                       String namespace, String name,
                       org.xml.sax.Attributes list)
                       throws java.lang.Exception {
@@ -526,7 +526,7 @@
      * class provided a way for this functionality to just be invoked
      * directly.
      */
-    private void fireBodyMethods(List rules,
+    private void fireBodyMethods(List<Rule> rules,
                     String namespaceURI, String name,
                     String text) throws Exception {
 
@@ -555,7 +555,7 @@
      * class provided a way for this functionality to just be invoked
      * directly.
      */
-    public void fireEndMethods(List rules,
+    public void fireEndMethods(List<Rule> rules,
                     String namespaceURI, String name)
                     throws Exception {
 

Modified: commons/proper/digester/trunk/src/java/org/apache/commons/digester/plugins/PluginManager.java
URL: http://svn.apache.org/viewvc/commons/proper/digester/trunk/src/java/org/apache/commons/digester/plugins/PluginManager.java?rev=729122&r1=729121&r2=729122&view=diff
==============================================================================
--- commons/proper/digester/trunk/src/java/org/apache/commons/digester/plugins/PluginManager.java (original)
+++ commons/proper/digester/trunk/src/java/org/apache/commons/digester/plugins/PluginManager.java Tue Dec 23 13:14:13 2008
@@ -39,10 +39,10 @@
 public class PluginManager {
 
     /** Map of classname->Declaration */
-    private HashMap declarationsByClass = new HashMap();
+    private HashMap<String, Declaration> declarationsByClass = new HashMap<String, Declaration>();
 
     /** Map of id->Declaration  */
-    private HashMap declarationsById = new HashMap();
+    private HashMap<String, Declaration> declarationsById = new HashMap<String, Declaration>();
 
     /** the parent manager to which this one may delegate lookups. */
     private PluginManager parent;
@@ -90,7 +90,7 @@
         Log log = LogUtils.getLogger(null);
         boolean debug = log.isDebugEnabled();
         
-        Class pluginClass = decl.getPluginClass();
+        Class<?> pluginClass = decl.getPluginClass();
         String id = decl.getId();
         
         declarationsByClass.put(pluginClass.getName(), decl);
@@ -145,7 +145,7 @@
      * If no source of custom rules can be found, null is returned.
      */
     public RuleLoader findLoader(Digester digester, String id, 
-                        Class pluginClass, Properties props) 
+                        Class<?> pluginClass, Properties props) 
                         throws PluginException {    
 
         // iterate over the list of RuleFinders, trying each one 
@@ -156,10 +156,10 @@
         boolean debug = log.isDebugEnabled();
         log.debug("scanning ruleFinders to locate loader..");
         
-        List ruleFinders = pluginContext.getRuleFinders();
+        List<RuleFinder> ruleFinders = pluginContext.getRuleFinders();
         RuleLoader ruleLoader = null;
         try {
-            for(Iterator i = ruleFinders.iterator(); 
+            for(Iterator<RuleFinder> i = ruleFinders.iterator(); 
                 i.hasNext() && ruleLoader == null; ) {
                     
                 RuleFinder finder = (RuleFinder) i.next();

Modified: commons/proper/digester/trunk/src/java/org/apache/commons/digester/plugins/PluginRules.java
URL: http://svn.apache.org/viewvc/commons/proper/digester/trunk/src/java/org/apache/commons/digester/plugins/PluginRules.java?rev=729122&r1=729121&r2=729122&view=diff
==============================================================================
--- commons/proper/digester/trunk/src/java/org/apache/commons/digester/plugins/PluginRules.java (original)
+++ commons/proper/digester/trunk/src/java/org/apache/commons/digester/plugins/PluginRules.java Tue Dec 23 13:14:13 2008
@@ -131,7 +131,7 @@
      Digester digester, 
      String mountPoint, 
      PluginRules parent, 
-     Class pluginClass) 
+     Class<?> pluginClass) 
      throws PluginException {
         // no need to set digester or decoratedRules.digester,
         // because when Digester.setRules is called, the setDigester
@@ -210,14 +210,14 @@
     /**
      * See {@link PluginContext#getRuleFinders}.
      */
-    public List getRuleFinders() {
+    public List<RuleFinder> getRuleFinders() {
         return pluginContext.getRuleFinders();
     }
     
     /**
      * See {@link PluginContext#setRuleFinders}.
      */
-    public void setRuleFinders(List ruleFinders) {
+    public void setRuleFinders(List<RuleFinder> ruleFinders) {
         pluginContext.setRuleFinders(ruleFinders);
     }
     
@@ -256,7 +256,7 @@
      * 
      * @return list of all Rule objects known to this Rules instance.
      */
-    public List rules() {
+    public List<Rule> rules() {
         return decoratedRules.rules();
     }
 
@@ -347,7 +347,7 @@
      *
      * @deprecated Call match(namespaceURI,pattern) instead.
      */
-    public List match(String path) {
+    public List<Rule> match(String path) {
         return (match(null, path));
     }
 
@@ -362,7 +362,7 @@
      *  or <code>null</code> to match regardless of namespace URI
      * @param path the path to the xml nodes to be matched.
      */
-    public List match(String namespaceURI, String path) {
+    public List<Rule> match(String namespaceURI, String path) {
         Log log = LogUtils.getLogger(digester);
         boolean debug = log.isDebugEnabled();
         
@@ -372,7 +372,7 @@
                 "] on rules object " + this.toString());
         }
 
-        List matches;
+        List<Rule> matches;
         if ((mountPoint != null) && 
             (path.length() <= mountPoint.length())) {
             if (debug) {