View Javadoc
1   package myorg.entityex.mapped;
2   
3   import java.math.BigDecimal;
4   import java.util.Date;
5   
6   import org.slf4j.Logger;
7   import org.slf4j.LoggerFactory;
8   
9   public class Cat {
10  	private static final Logger log = LoggerFactory.getLogger(Cat.class);
11  	private int id;
12  	private String name;
13  	private Date dob;
14  	private double weight;
15  	
16  	public Cat() {} //must have default ctor
17  	public Cat(String name, Date dob, double weight) {
18  		this.name = name;
19  		this.dob = dob;
20  		this.weight = weight;
21  	}
22  	
23  	public int getId() { return id; }
24  	public void setId(int id) {
25  		this.id = id;
26  	}
27  	
28  	public String getName() { return name; }
29  	public void setName(String name) {
30  		this.name = name;
31  	}
32  	
33  	public Date getDob() { return dob; }
34  	public void setDob(Date dob) {
35  		this.dob = dob;
36  	}
37  	
38  	public BigDecimal getWeight() {
39  		log.debug("mapped.getWeight()");
40  		return new BigDecimal(weight); 
41  	}
42  	public void setWeight(BigDecimal weight) {
43  		log.debug("mapped.setWeight()");
44  		this.weight = weight==null ? 0 : weight.doubleValue();
45  	}
46  }