ch.elca.el4j.tests.services.exceptionhandler
Class AImpl

java.lang.Object
  extended by ch.elca.el4j.tests.services.exceptionhandler.AImpl
All Implemented Interfaces:
A, Adder
Direct Known Subclasses:
B

public class AImpl
extends Object
implements A

Sample bean class used for testing.

Author:
Andreas Bur (ABU)
File-location:
AImpl
Last check-in date:
2009-08-04 13:59:45 +0200 (Di, 04. Aug 2009) by swismer for revision 3873

Field Summary
private  Adder m_adder
          The adder to delegate calls to.
private  int m_retries
          Number of retires.
static boolean s_concatFails
          Static field to set if the call should fail.
static int s_numberOfConcatCalls
          Static int to count number of method invocations.
 
Constructor Summary
AImpl()
           
 
Method Summary
 int add(int a, int b)
          Adds the two numbers.
 String concat(String a, String b)
          Concatenates the two Strings.
 int div(int a, int b)
          Divides the two integers.
static void reset()
          Resets the static counter.
 void setAdder(Adder adder)
          Sets the adder to delegate calls to.
 void setRetries(int retries)
          Sets the number of retries.
 int sub(int a, int b)
          Subtracts the given two numbers.
 void throwException()
          Throws an application level exception.
 void throwRTException()
          Throws a runtime exception.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

s_numberOfConcatCalls

public static int s_numberOfConcatCalls
Static int to count number of method invocations.


s_concatFails

public static boolean s_concatFails
Static field to set if the call should fail.


m_adder

private Adder m_adder
The adder to delegate calls to.


m_retries

private int m_retries
Number of retires.

Constructor Detail

AImpl

public AImpl()
Method Detail

reset

public static void reset()
Resets the static counter.


setRetries

public void setRetries(int retries)
Sets the number of retries.

Specified by:
setRetries in interface A
Parameters:
retries - Number of retries.

setAdder

public void setAdder(Adder adder)
Sets the adder to delegate calls to.

Specified by:
setAdder in interface A
Parameters:
adder - The adder to set.

div

public int div(int a,
               int b)
Divides the two integers.

Specified by:
div in interface A
Parameters:
a - Dividend.
b - Divisor.
Returns:
Returns a / b.

throwException

public void throwException()
                    throws ApplicationException
Throws an application level exception.

Specified by:
throwException in interface A
Throws:
ApplicationException - The sample exception.

throwRTException

public void throwRTException()
Throws a runtime exception.

Specified by:
throwRTException in interface A

concat

public String concat(String a,
                     String b)
Concatenates the two Strings.

Specified by:
concat in interface A
Parameters:
a - the first string.
b - the second string.
Returns:
Returns the concatenation of the two strings.

add

public int add(int a,
               int b)
Adds the two numbers.

Specified by:
add in interface A
Specified by:
add in interface Adder
Parameters:
a - The first number.
b - The second number.
Returns:
Returns the sum of a and b.

sub

public int sub(int a,
               int b)
Subtracts the given two numbers.

Specified by:
sub in interface A
Parameters:
a - The first number.
b - The second number.
Returns:
Returns a - b.


Copyright © 2005-2011 ELCA. All Rights Reserved.