September 2010
Intermediate to advanced
766 pages
18h 35m
English
Following is a full listing of all source code used in this runnable example.
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 ...