/** * Create a new writer handler. */ public AbstractObjectWriterHandler(boolean gentypetags, boolean prefertags, boolean flattening, Set typeinfos) { this.gentypetags = gentypetags; this.prefertags = prefertags; this.flattening = flattening; this.titmanager = new TypeInfoTypeManager(typeinfos); }
/** * Create a type info manager. */ public TypeInfoTypeManager(Set typeinfos) { if(typeinfos!=null) { for(Iterator it=typeinfos.iterator(); it.hasNext(); ) { addTypeInfo((TypeInfo)it.next()); } } }
/** * Get the most specific mapping info. * @param tag The tag. * @param fullpath The full path. * @return The most specific mapping info. */ public synchronized TypeInfo getTypeInfo(Object type, QName[] fullpath) { // Object type = getObjectType(object, context); // System.out.println("type is: "+type); TypeInfo ret = findTypeInfo((Set)typeinfos.get(type), fullpath); return ret; }
if(no_typeinfos==null || !no_typeinfos.contains(type)) ret = titmanager.getTypeInfo(type, fullpath); ret = titmanager.getTypeInfo(clazz, fullpath); if(ret==null) ret = titmanager.getTypeInfo(Object[].class, fullpath); titmanager.addTypeInfo(ti);
/** * Get the most specific mapping info. * @param type The type. * @param fullpath The full path. * @return The most specific mapping info. */ public TypeInfo getTypeInfo(Object object, QName[] fullpath, IContext context) { TypeInfo ret = null; Object type = getObjectType(object, context); Set tis = titmanager.getTypeInfosByType(type); if(tis!=null) { // Take not into account path if only one candidate if(tis.size()==1) { ret = (TypeInfo)tis.iterator().next(); } // Else disambiguate using path else if(tis.size()>1) { ret = titmanager.findTypeInfo(tis, fullpath); } } return ret; // return titmanager.getTypeInfo(type, fullpath); }
if(AttributeInfo.IDREF.equals(attrinfo.getId())) Set tis = titmanager.getTypeInfosByType(value.getClass()); if(tis==null || tis.size()!=1) throw new RuntimeException("Could not determine type info for idref object: "+value);
ret = getTypeInfoManager().getTypeInfo(clazz, fullpath); ret = getTypeInfoManager().getTypeInfo(Object[].class, fullpath); cricpy, ret.getMappingInfo(), ret.getLinkInfo()); getTypeInfoManager().addTypeInfo(ti);
/** * Create a new handler for Java XML supporting on-the-fly * type info creation for arrays. */ public BeanObjectReaderHandler(Set typeinfos) { this.titmanager = new TypeInfoTypeManager(typeinfos); }