Package com.sun.xml.internal.bind.v2.model.core

Examples of com.sun.xml.internal.bind.v2.model.core.Adapter


/* 119 */     Object t = this.seed.getRawType();
/*     */
/* 122 */     XmlJavaTypeAdapter xjta = getApplicableAdapter(t);
/* 123 */     if (xjta != null) {
/* 124 */       this.isCollection = false;
/* 125 */       this.adapter = new Adapter(xjta, reader(), nav());
/*     */     }
/*     */     else
/*     */     {
/* 129 */       this.isCollection = ((nav().isSubClassOf(t, nav().ref(Collection.class))) || (nav().isArrayButNotByteArray(t)));
/*     */
/* 132 */       xjta = getApplicableAdapter(getIndividualType());
/* 133 */       if (xjta == null)
/*     */       {
/* 135 */         XmlAttachmentRef xsa = (XmlAttachmentRef)this.seed.readAnnotation(XmlAttachmentRef.class);
/* 136 */         if (xsa != null) {
/* 137 */           parent.builder.hasSwaRef = true;
/* 138 */           this.adapter = new Adapter(nav().asDecl(SwaRefAdapter.class), nav());
/*     */         } else {
/* 140 */           this.adapter = null;
/*     */
/* 144 */           xjta = (XmlJavaTypeAdapter)this.seed.readAnnotation(XmlJavaTypeAdapter.class);
/* 145 */           if (xjta != null) {
/* 146 */             Object adapter = reader().getClassValue(xjta, "value");
/* 147 */             parent.builder.reportError(new IllegalAnnotationException(Messages.UNMATCHABLE_ADAPTER.format(new Object[] { nav().getTypeName(adapter), nav().getTypeName(t) }), xjta));
/*     */           }
/*     */
/*     */         }
/*     */
/*     */       }
/*     */       else
/*     */       {
/* 155 */         this.adapter = new Adapter(xjta, reader(), nav());
/*     */       }
/*     */     }
/*     */
/* 159 */     this.id = calcId();
/* 160 */     this.schemaType = Util.calcSchemaType(reader(), this.seed, parent.clazz, getIndividualType(), this);
View Full Code Here


/* 1339 */     return generateSwaRefAdapter(typeRef.getSource());
/*      */   }
/*      */
/*      */   private boolean generateSwaRefAdapter(PropertyInfo<T, C> prop)
/*      */   {
/* 1346 */     Adapter adapter = prop.getAdapter();
/* 1347 */     if (adapter == null) return false;
/* 1348 */     Object o = this.navigator.asDecl(SwaRefAdapter.class);
/* 1349 */     if (o == null) return false;
/* 1350 */     return o.equals(adapter.adapterType);
/*      */   }
View Full Code Here

/*     */     }
/*     */
/* 265 */     this.tagName = parseElementName(this.anno);
/* 266 */     Object[] methodParams = nav().getMethodParameters(m);
/*     */
/* 269 */     Adapter a = null;
/* 270 */     if (methodParams.length > 0) {
/* 271 */       XmlJavaTypeAdapter adapter = (XmlJavaTypeAdapter)reader().getMethodAnnotation(XmlJavaTypeAdapter.class, m, this);
/* 272 */       if (adapter != null) {
/* 273 */         a = new Adapter(adapter, reader(), nav());
/*     */       } else {
/* 275 */         XmlAttachmentRef xsa = (XmlAttachmentRef)reader().getMethodAnnotation(XmlAttachmentRef.class, m, this);
/* 276 */         if (xsa != null) {
/* 277 */           TODO.prototype("in APT swaRefAdapter isn't avaialble, so this returns null");
/* 278 */           a = new Adapter(this.owner.nav.asDecl(SwaRefAdapter.class), this.owner.nav);
/*     */         }
/*     */       }
/*     */     }
/* 282 */     this.adapter = a;
/*     */
View Full Code Here

/*     */   public RuntimeElementInfoImpl(RuntimeModelBuilder modelBuilder, RegistryInfoImpl registry, Method method)
/*     */     throws IllegalAnnotationException
/*     */   {
/*  68 */     super(modelBuilder, registry, method);
/*     */
/*  70 */     Adapter a = getProperty().getAdapter();
/*     */
/*  72 */     if (a != null)
/*  73 */       this.adapterType = ((Class)a.adapterType);
/*     */     else
/*  75 */       this.adapterType = null;
View Full Code Here

/*     */
/* 356 */     ReflectionNavigator nav = typeSet.getNavigator();
/*     */
/* 358 */     for (TypeReference tr : typeRefs) {
/* 359 */       XmlJavaTypeAdapter xjta = (XmlJavaTypeAdapter)tr.get(XmlJavaTypeAdapter.class);
/* 360 */       Adapter a = null;
/* 361 */       XmlList xl = (XmlList)tr.get(XmlList.class);
/*     */
/* 364 */       Class erasedType = nav.erasure(tr.type);
/*     */
/* 366 */       if (xjta != null) {
/* 367 */         a = new Adapter(xjta.value(), nav);
/*     */       }
/* 369 */       if (tr.get(XmlAttachmentRef.class) != null) {
/* 370 */         a = new Adapter(SwaRefAdapter.class, nav);
/* 371 */         this.hasSwaRef = true;
/*     */       }
/*     */
/* 374 */       if (a != null) {
/* 375 */         erasedType = nav.erasure((Type)a.defaultType);
View Full Code Here

        return addGenericElement(parent.owner.getElementInfo(parent.getClazz(),new QName(nsUri,r.name())));
    }

    private boolean addGenericElement(XmlElementRef r, ReferencePropertyInfoImpl<T,C,F,M> info) {
        String nsUri = info.getEffectiveNamespaceFor(r);
        ElementInfo ei = parent.owner.getElementInfo(info.parent.getClazz(), new QName(nsUri, r.name()));
        types.add(ei);
        return true;
    }
View Full Code Here

        boolean nillable = false; // default value

        QName name = elem.getElementName();
        Namespace n = getNamespace(name.getNamespaceURI());
        ElementInfo ei;

        if (elem.getScope() != null) { // (probably) never happens
            ei = this.types.getElementInfo(elem.getScope().getClazz(), name);
        } else {
            ei = this.types.getElementInfo(null, name);
        }

        XmlElement xmlElem = ei.getProperty().readAnnotation(XmlElement.class);

        if (xmlElem == null) {
            nillable = false;
        } else {
            nillable = xmlElem.nillable();
View Full Code Here

     * TODO: this is not the proper place for this class to be in.
     */
    public static Transducer createTransducer(RuntimeNonElementRef ref) {
        Transducer t = ref.getTarget().getTransducer();
        RuntimePropertyInfo src = ref.getSource();
        ID id = src.id();

        if(id==ID.IDREF)
            return RuntimeBuiltinLeafInfoImpl.STRING;

        if(id==ID.ID)
View Full Code Here

            t.toElementRef(prop);
    }

    public ID id() {
        for( Ref t : refs ) {
            ID id = t.id();
            if(id!=ID.NONE)    return id;
        }
        return ID.NONE;
    }
View Full Code Here

     */
    private void addTypeName(NonElement<T, C> r) {
        QName t = r.getTypeName();
        if(t==null)     return;

        TypeInfo old = typeNames.put(t,r);
        if(old!=null) {
            // collision
            reportError(new IllegalAnnotationException(
                    Messages.CONFLICTING_XML_TYPE_MAPPING.format(r.getTypeName()),
                    old, r ));
View Full Code Here

TOP

Related Classes of com.sun.xml.internal.bind.v2.model.core.Adapter

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.