avalon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Vinay Chandran <vinay...@yahoo.com>
Subject RE: Delegate Implementation is in place
Date Fri, 04 Oct 2002 09:00:32 GMT
Hi,

A few queries+patches regarding the delegates.

Why does the DelegateHandler handle the "boolean
equals(Object)" .
I guess the intend was to  handle the
Object.equals(Object) call ,
but I guess the InvocationHandler would only cater to
the method
defined within the interface and thus I could have a
delegate 
interface like:-

interface DelegateInf
{
	boolean equals(Object o);
}

and because of the handling of the equals within the
Delegate 
InvocationHandler , the implementation attached while
creating
the delegate does not get Invoked.
(a patch to the DelegateTestcase  to illustrate this
is attached)

Patch on Delegate.java for breaking out of conditions:
--------------------------------------------------
298a299
>                                 break;
304a306
>                             break;

PATCH on DelegateTestCase.java 
---------------------------
120a120,139
> 
>     public interface Test
>     {
> 		boolean equals(Object o);
> 	}
> 	public class TestImpl
> 	{
> 		public boolean equals(Object o)
> 		{
> 			System.out.println("***invoked****");
> 			return true;
> 		}
> 	}
> 	public void testEquals()
> 	{
> 		Test test = (Test)Delegate.newDelegate(new
TestImpl(),"equals",Test.class);
>
> 		// The equals override within TestImpl always
returns true .
> 		// yet this test Fails since InvocationHandler
handled 
>  		// this invocation
>
> 		assertTrue(test.equals("1")); //*** FAILURE
> 	}



Regards,
Vinay



__________________________________________________
Do you Yahoo!?
New DSL Internet Access from SBC & Yahoo!
http://sbc.yahoo.com

--
To unsubscribe, e-mail:   <mailto:avalon-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:avalon-dev-help@jakarta.apache.org>


Mime
View raw message