Id.java (648B)
1 package de.openrat.client.util; 2 3 public class Id extends Number 4 { 5 6 private static final long serialVersionUID = -1360182293567671578L; 7 8 private final long value; 9 10 Id(long id) 11 { 12 this.value = id; 13 } 14 15 Id(int id) 16 { 17 this.value = (long) id; 18 } 19 20 Id(short id) 21 { 22 this.value = (long) id; 23 } 24 25 @Override 26 public int intValue() 27 { 28 return (int) value; 29 } 30 31 @Override 32 public long longValue() 33 { 34 return value; 35 } 36 37 @Override 38 public float floatValue() 39 { 40 throw new ArithmeticException("this id is never a float value"); 41 } 42 43 @Override 44 public double doubleValue() 45 { 46 throw new ArithmeticException("this id is never a double value"); 47 } 48 49 }