CMSObject.java (1239B)
1 package de.openrat.client.dto; 2 3 import java.io.Serializable; 4 5 import de.openrat.client.util.Id; 6 7 public class CMSObject implements Serializable 8 { 9 private static final long serialVersionUID = -7483013624561450027L; 10 11 private Id id; 12 13 /** 14 * Inhalt des Feldes <code>id</code>. 15 * 16 * @return id 17 */ 18 public Id getId() 19 { 20 return id; 21 } 22 23 /** 24 * Setzt das Feld <code>id</code>. 25 * 26 * @param id 27 * id 28 */ 29 public void setId(Id id) 30 { 31 this.id = id; 32 } 33 34 /** 35 * {@inheritDoc} 36 * 37 * @see java.lang.Object#hashCode() 38 */ 39 @Override 40 public int hashCode() 41 { 42 final int prime = 31; 43 int result = 1; 44 result = prime * result + ((id == null) ? 0 : id.hashCode()); 45 return result; 46 } 47 48 /** 49 * {@inheritDoc} 50 * 51 * @see java.lang.Object#equals(java.lang.Object) 52 */ 53 @Override 54 public boolean equals(Object obj) 55 { 56 if (this == obj) 57 return true; 58 if (obj == null) 59 return false; 60 if (getClass() != obj.getClass()) 61 return false; 62 CMSObject other = (CMSObject) obj; 63 if (id == null) 64 { 65 if (other.id != null) 66 return false; 67 } 68 else if (!id.equals(other.id)) 69 return false; 70 return true; 71 } 72 73 @Override 74 public String toString() 75 { 76 return super.toString() + ": Id " + id.longValue(); 77 } 78 }