Return-Path: Delivered-To: apmail-jakarta-avalon-cvs-archive@apache.org Received: (qmail 74792 invoked from network); 3 Oct 2002 17:40:34 -0000 Received: from unknown (HELO nagoya.betaversion.org) (192.18.49.131) by daedalus.apache.org with SMTP; 3 Oct 2002 17:40:34 -0000 Received: (qmail 15825 invoked by uid 97); 3 Oct 2002 17:38:07 -0000 Delivered-To: qmlist-jakarta-archive-avalon-cvs@jakarta.apache.org Received: (qmail 15779 invoked by uid 97); 3 Oct 2002 17:38:06 -0000 Mailing-List: contact avalon-cvs-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Avalon CVS List" Reply-To: "Avalon Developers List" Delivered-To: mailing list avalon-cvs@jakarta.apache.org Received: (qmail 15745 invoked by uid 97); 3 Oct 2002 17:38:06 -0000 X-Antivirus: nagoya (v4218 created Aug 14 2002) Date: 3 Oct 2002 17:37:15 -0000 Message-ID: <20021003173715.53764.qmail@icarus.apache.org> From: bloritsch@apache.org To: jakarta-avalon-excalibur-cvs@apache.org Subject: cvs commit: jakarta-avalon-excalibur/util/src/java/org/apache/excalibur/util MultiDelegate.java MultiDelegateFactory.java X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N bloritsch 2002/10/03 10:37:15 Modified: util/src/java/org/apache/excalibur/util MultiDelegate.java MultiDelegateFactory.java Log: updates to JavaDocs, and more explicit throws clauses. Also *only* throw IllegalArgumentException Revision Changes Path 1.2 +6 -1 jakarta-avalon-excalibur/util/src/java/org/apache/excalibur/util/MultiDelegate.java Index: MultiDelegate.java =================================================================== RCS file: /home/cvs/jakarta-avalon-excalibur/util/src/java/org/apache/excalibur/util/MultiDelegate.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- MultiDelegate.java 3 Oct 2002 16:59:39 -0000 1.1 +++ MultiDelegate.java 3 Oct 2002 17:37:15 -0000 1.2 @@ -111,11 +111,16 @@ /** * Adds a new delegate to the MultiDelegate's list. The Delegate is only added * if it does not yet exist in the list. + * + * @param o The delegate we are adding to this MultiDelegate. The delegate + * must use the same interface this MultiDelegate is using. */ public void add (Object o); /** * Removes a delegate from the MultiDelegate's list. - */ + * + * @param o The delegate we are removing from this MultiDelegate. + */ public void remove (Object o); } 1.2 +16 -5 jakarta-avalon-excalibur/util/src/java/org/apache/excalibur/util/MultiDelegateFactory.java Index: MultiDelegateFactory.java =================================================================== RCS file: /home/cvs/jakarta-avalon-excalibur/util/src/java/org/apache/excalibur/util/MultiDelegateFactory.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- MultiDelegateFactory.java 3 Oct 2002 16:59:39 -0000 1.1 +++ MultiDelegateFactory.java 3 Oct 2002 17:37:15 -0000 1.2 @@ -52,6 +52,7 @@ import java.lang.reflect.InvocationHandler; import java.lang.reflect.Method; import java.lang.reflect.Proxy; +import java.lang.reflect.InvocationTargetException; import java.util.ArrayList; import java.util.Iterator; @@ -93,8 +94,12 @@ } /** - * Creates a new MultiDelegateHandler. The handler's add and remove methods will only accept - * objects that implements the interface given in delegateClass. + * Creates a new MultiDelegateHandler. The handler's add and remove methods will + * only accept objects that implements the interface given in delegateClass. + * The Class passed in must be an interface with only one method that returns + * void + * + * @param delegateClass The interface representing the MultiDelegate. */ public MultiDelegateHandler( Class delegateClass ) { @@ -104,14 +109,21 @@ /** * Handles invocations. If the call is made through the MultiDelegate interface, * the appropriate methods are called. Otherwise the delegate methods are called. + * + * @param proxy The object to forward the method invocations to. + * @param method The method that was called + * @param args The arguments used for the method + * + * @return Object must always be an "instance" of void.class */ - public Object invoke(Object proxy, Method method, Object[] args) throws Throwable + public Object invoke(Object proxy, Method method, Object[] args) + throws IllegalAccessException, InvocationTargetException { if (method.equals (addMethod)) { if( args[0] == null ) { - throw new NullPointerException( "Argument to MultiDelegate.add(Object) is null." ); + throw new IllegalArgumentException( "Argument to MultiDelegate.add(Object) is null." ); } if( !delegateClass.isAssignableFrom(args[0].getClass()) ) @@ -205,5 +217,4 @@ new Class[]{ MultiDelegate.class, delegateInterface }, new MultiDelegateHandler( delegateInterface )); } - } -- To unsubscribe, e-mail: For additional commands, e-mail: