jicarilla-sandbox/platform/container/impl/src/java/org/jicarilla/container DefaultContainer.java,1.11,1.12

Leo Simons <[email protected]>
Newsgroups gmane.comp.java.jicarilla.cvs
Message-ID <[email protected]>
Update of /cvsroot/jicarilla/jicarilla-sandbox/platform/container/impl/src/java/org/jicarilla/container
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4130/platform/container/impl/src/java/org/jicarilla/container

Modified Files:
	DefaultContainer.java 
Log Message:
make DefaultContainer use PolicyUtil

Index: DefaultContainer.java
===================================================================
RCS file: /cvsroot/jicarilla/jicarilla-sandbox/platform/container/impl/src/java/org/jicarilla/container/DefaultContainer.java,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- DefaultContainer.java	23 Mar 2004 13:37:51 -0000	1.11
+++ DefaultContainer.java	23 Mar 2004 14:34:48 -0000	1.12
@@ -27,6 +27,7 @@
 
 import org.jicarilla.container.selectors.ClassSelector;
 import org.jicarilla.container.util.ReflectionUtil;
+import org.jicarilla.container.util.PolicyUtil;
 import org.jicarilla.lang.Assert;
 import org.jicarilla.lang.EquivalenceSelector;
 import org.jicarilla.lang.Selector;
@@ -222,21 +223,20 @@
      * @param adapter the new adapter. The {@link m_resolver current resolver}
      *     should know how to use this adapter.
      */
-    protected void doAddAdapter( final Selector selector,
+    /*protected void doAddAdapter( final Selector selector,
             final Object adapter )
     {
         Assert.assertNotNull( "selector argument may not be null", selector );
         Assert.assertNotNull( "adapter argument may not be null", adapter );
 
         getSwitch().put( selector, adapter );
-    }
+    }*/
 
     /**
      * Add a new adapter. If you are providing an {@link Adapter} instance,
      * use the public {@link #registerAdapter(Object,Adapter)} instead.
      * Implements some special handling for some key types (ie classes and some
-     * kinds of strings); use {@link #doAddAdapter(Selector,Object)} to avoid
-     * this.
+     * kinds of strings).
      *
      * @param key
      * @param adapter the new adapter. The {@link m_resolver current resolver}
@@ -246,31 +246,10 @@
     {
         Assert.assertNotNull( "key argument may not be null", key );
         Assert.assertNotNull( "adapter argument may not be null", adapter );
+        
+        final Selector selector = PolicyUtil.getSelectorForCriterion( key );
 
-        if( key instanceof Selector )
-        {
-            getSwitch().put( key, adapter );
-            return;
-        }
-
-        if( key instanceof Class )
-        {
-            getSwitch().put( new ClassSelector( (Class)key ), adapter );
-            return;
-        }
-
-        if( key instanceof String )
-        {
-            try
-            {
-                final Class clazz = ReflectionUtil.loadClass( (String)key );
-                getSwitch().put( new ClassSelector( clazz ), adapter );
-                return;
-            }
-            catch( ClassNotFoundException e ) {}
-        }
-
-        getSwitch().put( new EquivalenceSelector( key ), adapter );
+        getSwitch().put( selector, adapter );
     }
 
     // ----------------------------------------------------------------------



-------------------------------------------------------
This SF.Net email is sponsored by: IBM Linux Tutorials
Free Linux tutorial presented by Daniel Robbins, President and CEO of
GenToo technologies. Learn everything from fundamentals to system
administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.