attrib4j.examples
Class InheritanceTxExample

java.lang.Object
  |
  +--attrib4j.examples.AbstractDeposit
        |
        +--attrib4j.examples.InheritanceTxExample
All Implemented Interfaces:
DepositTransaction

public class InheritanceTxExample
extends AbstractDeposit

A simple example class that demonstrates the use of custom attributes. The idea is to associate EJB like transaction attributes to a method, much like would be described in the deployment descriptor. This example shows inheritance of attributes through interfaces an abstract base classes.

Author:
Mark Pollack

Constructor Summary
InheritanceTxExample()
          Create an instance.
 
Method Summary
 void deposit(int accountNbr, long amount)
          Just a placehold to test out attributes in the inheritance chain.
 void extractAttributes()
          Show how attributes can be extracted at runtime.
static void main(java.lang.String[] args)
          Run the example program.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

InheritanceTxExample

public InheritanceTxExample()
Create an instance.

Method Detail

deposit

public void deposit(int accountNbr,
                    long amount)
Description copied from class: AbstractDeposit
Just a placehold to test out attributes in the inheritance chain.

Specified by:
deposit in interface DepositTransaction
Specified by:
deposit in class AbstractDeposit
Parameters:
accountNbr -
amount -

extractAttributes

public void extractAttributes()
                       throws java.lang.NoSuchMethodException
Show how attributes can be extracted at runtime.

Throws:
java.lang.NoSuchMethodException - if cannot find declared method on class.

main

public static void main(java.lang.String[] args)
Run the example program. It will execute a method that has been decorated with an attribute, just to show that the functionality has not been altered. Then it will extract the attributes from the class.

Parameters:
args - The command line arguments, not used.


Copyright © 2002-2003 Mark Pollack. All Rights Reserved.