View Javadoc

1   /*
2    * Created on 30.04.2005 from Linke
3    *
4    */
5   package test.crispy.example.model;
6   
7   import java.io.Serializable;
8   
9   /**
10   * @author Linke
11   *
12   */
13  public class Primitive implements Serializable {
14  	
15  	private static final long serialVersionUID = -8311363655629654330L;
16  	
17  	private boolean booleanValue = false;
18  	private byte byteValue = 0;
19  	private short shortValue = 0;
20  	private int intValue = 0;
21  	private long longValue = 0;
22  	private double doubleValue = 0;
23  	private float floatValue = 0;
24  	private char charValue = 'A';
25  	
26  	public static Primitive createPrimitiveExample() {
27          Primitive lvPrimitive = new Primitive();
28          lvPrimitive.setBooleanValue(true);
29          lvPrimitive.setByteValue((byte) 2);
30          lvPrimitive.setCharValue('a');
31          lvPrimitive.setDoubleValue(2.3d);
32          lvPrimitive.setFloatValue(3.4f);
33          lvPrimitive.setIntValue(3);
34          lvPrimitive.setLongValue(5l);
35          lvPrimitive.setShortValue((short) 7);
36          return lvPrimitive;
37  	}
38  
39  	public int hashCode() {
40  		return (int) (byteValue + shortValue + intValue + longValue);
41  	}
42  	
43  	public boolean equals(Object pvPrimitive) {
44  		if (pvPrimitive == null) {
45  			return false;
46  		}
47  		if (pvPrimitive instanceof Primitive) {
48  			Primitive lvPrimitive = (Primitive) pvPrimitive;
49  			if (lvPrimitive.getBooleanValue() == this.getBooleanValue() &&
50  				lvPrimitive.getByteValue() == this.getByteValue() &&
51  				lvPrimitive.getCharValue() == this.getCharValue() && 
52  				lvPrimitive.getDoubleValue() == this.getDoubleValue() && 
53  				lvPrimitive.getFloatValue() == this.getFloatValue() &&
54  				lvPrimitive.getIntValue() == this.getIntValue() && 
55  				lvPrimitive.getLongValue() == this.getLongValue() && 
56  				lvPrimitive.getShortValue() == this.getShortValue()
57  				) 
58  			{
59  				
60  				return true;
61  			} else {
62  				return false;
63  			}
64  		} else {
65  			return false;
66  		}
67  	}
68  	
69  	public boolean getBooleanValue() {
70  		return booleanValue;
71  	}
72  	public void setBooleanValue(boolean pvBooleanValue) {
73  		booleanValue = pvBooleanValue;
74  	}
75  	public byte getByteValue() {
76  		return byteValue;
77  	}
78  	public void setByteValue(byte pvByteValue) {
79  		byteValue = pvByteValue;
80  	}
81  	public char getCharValue() {
82  		return charValue;
83  	}
84  	public void setCharValue(char pvCharValue) {
85  		charValue = pvCharValue;
86  	}
87  	public double getDoubleValue() {
88  		return doubleValue;
89  	}
90  	public void setDoubleValue(double pvDoubleValue) {
91  		doubleValue = pvDoubleValue;
92  	}
93  	public float getFloatValue() {
94  		return floatValue;
95  	}
96  	public void setFloatValue(float pvFloatValue) {
97  		floatValue = pvFloatValue;
98  	}
99  	public int getIntValue() {
100 		return intValue;
101 	}
102 	public void setIntValue(int pvIntValue) {
103 		intValue = pvIntValue;
104 	}
105 	public long getLongValue() {
106 		return longValue;
107 	}
108 	public void setLongValue(long pvLongValue) {
109 		longValue = pvLongValue;
110 	}
111 	public short getShortValue() {
112 		return shortValue;
113 	}
114 	public void setShortValue(short pvShortValue) {
115 		shortValue = pvShortValue;
116 	}
117 
118 }