1 4 package com.tc.objectserver.mgmt; 5 6 import com.tc.object.dna.impl.ClassInstance; 7 import com.tc.object.dna.impl.UTF8ByteDataHolder; 8 9 public class FacadeUtil { 10 11 public static String getFieldType(Object value) { 12 return getShortClassName(value.getClass().getName()); 14 } 15 16 private static String getShortClassName(String className) { 17 char chars[] = className.toCharArray(); 18 int lastDot = 0; 19 for (int i = 0; i < chars.length; i++) { 20 if (chars[i] == '.') { 21 lastDot = i + 1; 22 continue; 23 } 24 if (chars[i] == '$') chars[i] = '.'; 25 } 26 27 return new String (chars, lastDot, chars.length - lastDot); 28 } 29 30 public static Object processValue(Object value) { 31 if (value instanceof UTF8ByteDataHolder) { 32 value = ((UTF8ByteDataHolder) value).asString(); 33 } else if (value instanceof ClassInstance) { 34 value = ((ClassInstance) value).getName().asString(); 35 } 36 return value; 37 } 38 39 } 40 | Popular Tags |