/** * Get the string representation. */ public String toString() { return getGenericTypeName()!=null? getGenericTypeName(): "n/a"; }
ret = getGenericTypeName().equals(ci.getGenericTypeName());
/** * */ public String convertToString(ClassInfo val) { // return val==null || val.getTypeName().length()==0? null: val.getPrefixNotation(); return val==null || val.getTypeName().length()==0? null: SReflect.getUnqualifiedTypeName(val.getGenericTypeName()); }
/** * */ public ClassInfo getModelValue(String val) { ClassInfo ret = null; boolean suffix = val.indexOf(".")==-1; for(ClassInfo item : entries) { if(item.getTypeName().equals(val) || item.getGenericTypeName().equals(val) || (suffix && item.getTypeName().endsWith(val))) { ret = item; break; } } return ret; } }
/** * Process an object. * @param object The object. * @param targetcl If not null, the traverser should make sure that the result object is compatible with the class loader, * e.g. by cloning the object using the class loaded from the target class loader. * @return The processed object. */ public Object process(Object object, Type type, List<ITraverseProcessor> processors, Traverser traverser, Map<Object, Object> traversed, boolean clone, ClassLoader targetcl, Object context) { JsonWriteContext wr = (JsonWriteContext)context; wr.addObject(traversed, object); wr.write("{"); wr.writeNameValue("value", "\""+((ClassInfo)object).getGenericTypeName()+"\""); if(wr.isWriteClass()) wr.write(",").writeClass(object.getClass()); if(wr.isWriteId()) wr.write(",").writeId(); wr.write("}"); return object; } }