View Javadoc

1   /*
2    * Copyright 2006-2007 the original author or authors.
3    *
4    * Licensed under the Apache License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    *      http://www.apache.org/licenses/LICENSE-2.0
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  
17  package org.springframework.batch.sample.domain.trade;
18  
19  import java.math.BigDecimal;
20  
21  /**
22   * Immutable Value Object representing an update to the customer as stored in the database. 
23   * This object has the customer name, credit ammount, and the operation to be performed
24   * on them.  In the case of an add, a new customer will be entered with the appropriate 
25   * credit.  In the case of an update, the customer's credit is considered an absolute update.
26   * Deletes are currently not supported, but can still be read in from a file.
27   * 
28   * @author Lucas Ward
29   * @since 2.0
30   */
31  public class CustomerUpdate {
32  
33  	private final CustomerOperation operation;
34  	private final String customerName;
35  	private final BigDecimal credit;
36  	
37  	public CustomerUpdate(CustomerOperation operation, String customerName, BigDecimal credit) {
38  		this.operation = operation;
39  		this.customerName = customerName;
40  		this.credit = credit;
41  	}
42  
43  	public CustomerOperation getOperation() {
44  		return operation;
45  	}
46  
47  	public String getCustomerName() {
48  		return customerName;
49  	}
50  
51  	public BigDecimal getCredit() {
52  		return credit;
53  	}
54  	
55  	@Override
56  	public String toString() {
57  		return "Customer Update, name: [" + customerName + "], operation: [" + operation + "], credit: [" + credit + "]";
58  	}
59  }