View Javadoc
1   package com.opencsv.bean.mocks;
2   
3   import java.util.UUID;
4   
5   /*
6    * Copyright 2007 Kyle Miller.
7    *
8    * Licensed under the Apache License, Version 2.0 (the "License");
9    * you may not use this file except in compliance with the License.
10   * You may obtain a copy of the License at
11   *
12   * http://www.apache.org/licenses/LICENSE-2.0
13   *
14   * Unless required by applicable law or agreed to in writing, software
15   * distributed under the License is distributed on an "AS IS" BASIS,
16   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17   * See the License for the specific language governing permissions and
18   * limitations under the License.
19   */
20  public class MockBean {
21     private String name;
22     private String id;
23     private String orderNumber;
24     private int num;
25     private double doubleNum;
26     private UUID uuid;
27  
28     public MockBean() {}
29  
30     public MockBean(String name, String id, String orderNumber, int num, double doubleNum) {
31        this.name = name;
32        this.id = id;
33        this.orderNumber = orderNumber;
34        this.num = num;
35        this.doubleNum = doubleNum;
36     }
37  
38     public String getId() {
39        return id;
40     }
41  
42     public void setId(String id) {
43        this.id = id;
44     }
45  
46     public String getName() {
47        return name;
48     }
49  
50     public void setName(String name) {
51        this.name = name;
52     }
53  
54     public String getOrderNumber() {
55        return orderNumber;
56     }
57  
58     public void setOrderNumber(String orderNumber) {
59        this.orderNumber = orderNumber;
60     }
61  
62     public int getNum() {
63        return num;
64     }
65  
66     public void setNum(int num) {
67        this.num = num;
68     }
69  
70     public double getDoubleNum() {
71        return doubleNum;
72     }
73  
74     public void setDoubleNum(double doubleNum) {
75        this.doubleNum = doubleNum;
76     }
77  
78     public UUID getUuid() {
79        return uuid;
80     }
81  
82     public void setUuid(UUID uuid) {
83        this.uuid = uuid;
84     }
85  
86     @Override
87     public boolean equals(Object o) {
88        if (this == o) return true;
89        if (!(o instanceof MockBean)) return false;
90  
91        MockBean mockBean = (MockBean) o;
92  
93        if (getNum() != mockBean.getNum()) return false;
94        if (Double.compare(mockBean.getDoubleNum(), getDoubleNum()) != 0) return false;
95        if (getName() != null ? !getName().equals(mockBean.getName()) : mockBean.getName() != null) return false;
96        if (getId() != null ? !getId().equals(mockBean.getId()) : mockBean.getId() != null) return false;
97        if (getUuid() != null ? !getUuid().equals(mockBean.getUuid()) : mockBean.getUuid() != null) return false;
98        return !(getOrderNumber() != null ? !getOrderNumber().equals(mockBean.getOrderNumber()) : mockBean.getOrderNumber() != null);
99  
100    }
101 
102    @Override
103    public int hashCode() {
104       int result;
105       long temp;
106       result = getName() != null ? getName().hashCode() : 0;
107       result = 31 * result + (getId() != null ? getId().hashCode() : 0);
108       result = 31 * result + (getOrderNumber() != null ? getOrderNumber().hashCode() : 0);
109       result = 31 * result + getNum();
110       result = 31 * result + (getUuid() != null ? getUuid().hashCode() : 0);
111       temp = Double.doubleToLongBits(getDoubleNum());
112       result = 31 * result + (int) (temp ^ (temp >>> 32));
113       return result;
114    }
115 
116    @Override
117    public String toString() {
118       return "MockBean{" +
119               "name='" + name + '\'' +
120               ", id='" + id + '\'' +
121               ", orderNumber='" + orderNumber + '\'' +
122               ", num=" + num +
123               ", doubleNum=" + doubleNum +
124               ", uuid=" + uuid +
125               '}';
126    }
127 }