Determine the datatype of an object. @param o Object to test. @return byte code of the type, or ERROR if we don't know.
(Object o)
| 97 | * @return byte code of the type, or ERROR if we don't know. |
| 98 | */ |
| 99 | public static byte findType(Object o) { |
| 100 | if (o == null) { |
| 101 | return NULL; |
| 102 | } |
| 103 | |
| 104 | // Try to put the most common first |
| 105 | if (o instanceof DataByteArray) { |
| 106 | return BYTEARRAY; |
| 107 | } else if (o instanceof String) { |
| 108 | return CHARARRAY; |
| 109 | } else if (o instanceof Tuple) { |
| 110 | return TUPLE; |
| 111 | } else if (o instanceof DataBag) { |
| 112 | return BAG; |
| 113 | } else if (o instanceof Integer) { |
| 114 | return INTEGER; |
| 115 | } else if (o instanceof Long) { |
| 116 | return LONG; |
| 117 | } else if (o instanceof InternalMap) { |
| 118 | return INTERNALMAP; |
| 119 | } else if (o instanceof Map) { |
| 120 | return MAP; |
| 121 | } else if (o instanceof Float) { |
| 122 | return FLOAT; |
| 123 | } else if (o instanceof Double) { |
| 124 | return DOUBLE; |
| 125 | } else if (o instanceof Boolean) { |
| 126 | return BOOLEAN; |
| 127 | } else if (o instanceof DateTime) { |
| 128 | return DATETIME; |
| 129 | } else if (o instanceof Byte) { |
| 130 | return BYTE; |
| 131 | } else if (o instanceof BigInteger) { |
| 132 | return BIGINTEGER; |
| 133 | } else if (o instanceof BigDecimal) { |
| 134 | return BIGDECIMAL; |
| 135 | } else if (o instanceof WritableComparable) { |
| 136 | return GENERIC_WRITABLECOMPARABLE; |
| 137 | } else {return ERROR;} |
| 138 | } |
| 139 | |
| 140 | /** |
| 141 | * Given a Type object determine the data type it represents. This isn't |