1 package org.objectweb.rentacar.persistance.bo; 2 3 import javax.xml.bind.annotation.AccessType; 4 import javax.xml.bind.annotation.XmlAccessorType; 5 import javax.xml.bind.annotation.XmlType; 6 7 import org.apache.commons.lang.builder.EqualsBuilder; 8 import org.apache.commons.lang.builder.HashCodeBuilder; 9 import org.apache.commons.lang.builder.ToStringBuilder; 10 11 16 @XmlAccessorType(AccessType.FIELD) 17 @XmlType(name = "carVO", propOrder = { 18 "brand", 19 "carId", 20 "model", 21 "type" 22 }) 23 public class CarVO { 24 25 private String carId; 26 27 private String type; 28 29 private String brand; 30 31 private String model; 32 33 public CarVO() { 34 super(); 35 } 37 38 public CarVO(String type, String brand, String model) { 39 super(); 40 this.type = type; 41 this.brand = brand; 42 this.model = model; 43 } 44 45 public CarVO(String carId, String type, String brand, String model) { 46 super(); 47 this.carId = carId; 48 this.type = type; 49 this.brand = brand; 50 this.model = model; 51 } 52 53 public CarVO(Car car) { 54 super(); 55 this.carId = car.getCarId(); 56 this.type = car.getType(); 57 this.brand = car.getBrand(); 58 this.model = car.getModel(); 59 } 60 61 public String getBrand() { 62 return brand; 63 } 64 65 public void setBrand(String brand) { 66 this.brand = brand; 67 } 68 69 public String getCarId() { 70 return carId; 71 } 72 73 public void setCarId(String carId) { 74 this.carId = carId; 75 } 76 77 public String getModel() { 78 return model; 79 } 80 81 public void setModel(String model) { 82 this.model = model; 83 } 84 85 public String getType() { 86 return type; 87 } 88 89 public void setType(String type) { 90 this.type = type; 91 } 92 93 96 public boolean equals(Object object) { 97 if (!(object instanceof CarVO)) { 98 return false; 99 } 100 CarVO rhs = (CarVO) object; 101 return new EqualsBuilder().append(this.brand, rhs.brand).append( 102 this.type, rhs.type).append( 103 this.model, rhs.model).append(this.carId, rhs.carId).isEquals(); 104 } 105 106 109 public int hashCode() { 110 return new HashCodeBuilder(-1168981869, -109522229).append(this.brand) 111 .append(this.type).append(this.model) 112 .append(this.carId).toHashCode(); 113 } 114 115 118 public String toString() { 119 return new ToStringBuilder(this).append("model", this.model).append( 120 "carId", this.carId).append( 121 "type", this.type).append( 122 "brand", this.brand).toString(); 123 } 124 125 126 127 } 128 | Popular Tags |