KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > slide > projector > value > ObjectValue


1 package org.apache.slide.projector.value;
2
3
4 public class ObjectValue implements Comparable JavaDoc, Value {
5     private Object JavaDoc object;
6
7     public ObjectValue(Object JavaDoc object) {
8         this.object = object;
9     }
10
11     public Object JavaDoc getObject() {
12         return object;
13     }
14
15     public String JavaDoc getContentType() {
16         return object.getClass().getName();
17     }
18
19     public String JavaDoc toString() {
20         return object.toString();
21     }
22      
23     public int compareTo(Object JavaDoc o) {
24         Object JavaDoc 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 JavaDoc)object).compareTo(comparableObject);
30         }
31         return 0;
32     }
33 }
Popular Tags