bloritsch 2002/10/02 21:44:39
Modified: util/src/java/org/apache/excalibur/util Delegate.java
util/src/test/org/apache/excalibur/util/test
DelegateTestCase.java TestDelegate.java
Log:
make the method work
Revision Changes Path
1.2 +14 -2
jakarta-avalon-excalibur/util/src/java/org/apache/excalibur/util/Delegate.java
Index: Delegate.java
===================================================================
RCS file:
/home/cvs/jakarta-avalon-excalibur/util/src/java/org/apache/excalibur/util/Delegate.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- Delegate.java 3 Oct 2002 04:34:46 -0000 1.1
+++ Delegate.java 3 Oct 2002 04:44:39 -0000 1.2
@@ -62,8 +62,8 @@
*/
public abstract class Delegate
{
- protected final Method m_method;
- protected final Object m_object;
+ private final Method m_method;
+ private final Object m_object;
/**
* Pass in the delegate object that implements the same method that
@@ -126,6 +126,18 @@
catch( Exception e )
{
throw new IllegalArgumentException( "The class does not implement the
required method." );
+ }
+ }
+
+ protected final Object invoke( Object[] args )
+ {
+ try
+ {
+ return (String) m_method.invoke( m_object, args );
+ }
+ catch( Exception e )
+ {
+ throw new RuntimeException( "Bad Method" );
}
}
}
1.2 +2 -2
jakarta-avalon-excalibur/util/src/test/org/apache/excalibur/util/test/DelegateTestCase.java
Index: DelegateTestCase.java
===================================================================
RCS file:
/home/cvs/jakarta-avalon-excalibur/util/src/test/org/apache/excalibur/util/test/DelegateTestCase.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- DelegateTestCase.java 3 Oct 2002 04:34:47 -0000 1.1
+++ DelegateTestCase.java 3 Oct 2002 04:44:39 -0000 1.2
@@ -64,7 +64,7 @@
super( name );
}
- private final class Echo
+ public final class Echo
{
public String echo( String message )
{
@@ -72,7 +72,7 @@
}
}
- private final class OtherEcho
+ public final class OtherEcho
{
public String echo( String message )
{
1.2 +2 -9
jakarta-avalon-excalibur/util/src/test/org/apache/excalibur/util/test/TestDelegate.java
Index: TestDelegate.java
===================================================================
RCS file:
/home/cvs/jakarta-avalon-excalibur/util/src/test/org/apache/excalibur/util/test/TestDelegate.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- TestDelegate.java 3 Oct 2002 04:34:47 -0000 1.1
+++ TestDelegate.java 3 Oct 2002 04:44:39 -0000 1.2
@@ -57,7 +57,7 @@
*
* @author <a href="mailto:[EMAIL PROTECTED]">Berin Loritsch</a>
*/
-public class TestDelegate extends Delegate
+public final class TestDelegate extends Delegate
{
public TestDelegate( Object objDelegate )
{
@@ -73,13 +73,6 @@
*/
public String echo( String message )
{
- try
- {
- return (String) m_method.invoke( m_object, new Object[] {message} );
- }
- catch( Exception e )
- {
- throw new RuntimeException( "Bad Method" );
- }
+ return (String) invoke( new Object[] {message} );
}
}
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>