1 package org.apache.slide.projector.value; 2 3 4 public class ObjectValue implements Comparable , Value { 5 private Object object; 6 7 public ObjectValue(Object object) { 8 this.object = object; 9 } 10 11 public Object getObject() { 12 return object; 13 } 14 15 public String getContentType() { 16 return object.getClass().getName(); 17 } 18 19 public String toString() { 20 return object.toString(); 21 } 22 23 public int compareTo(Object o) { 24 Object comparableObject = null; 25 if ( o instanceof ObjectValue ) { 26 comparableObject = ((ObjectValue)o).getObject(); 27 } 28 if ( comparableObject != null && object.getClass().equals(comparableObject.getClass()) ) { 29 return ((Comparable )object).compareTo(comparableObject); 30 } 31 return 0; 32 } 33 } | Popular Tags |