Source Listing

Following is a full listing of all source code used in this runnable example.

Implementation Resources

CreditCardTransaction.java

package org.jboss.ejb3.examples.ch19.timer.api; import java.math.BigDecimal; /** * Value object representing a single credit card transaction. * Immutable. * * @author <a href="mailto:andrew.rubinger@jboss.org">ALR</a> * @version $Revision: $ */ public class CreditCardTransaction { //--------------------------------------------------------------------------|| // Instance Members --------------------------------------------------------|| //--------------------------------------------------------------------------|| /** * The card number */ private final String cardNumber; /** * The amount to be charged */ private final BigDecimal amount; //--------------------------------------------------------------------------|| // Constructor -------------------------------------------------------------|| //--------------------------------------------------------------------------|| /** * Creates a new instance with the specified card number and amount * @param cardNumber * @param amount * @throws IllegalArgumentException If either argument is null */ public CreditCardTransaction(final String cardNumber, final BigDecimal amount) throws IllegalArgumentException { // Precondition checks if (cardNumber == null || cardNumber.length() == 0) { throw new IllegalArgumentException("card number must be specified"); } if (amount == null) { throw new IllegalArgumentException("amount ...

Get Enterprise JavaBeans 3.1, 6th Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.