类javax.xml.bind.annotation.XmlAttachmentRef源码实例Demo

下面列出了怎么用javax.xml.bind.annotation.XmlAttachmentRef的API类实例代码及写法,或者点击链接到github查看源代码。

源代码1 项目: TencentKona-8   文件: TypeAndAnnotationImpl.java
public void annotate(JAnnotatable programElement) {
    if(typeUse.getAdapterUse()==null && !typeUse.isCollection())
        return; // nothing

    CAdapter adapterUse = typeUse.getAdapterUse();
    if(adapterUse!=null) {
        // ugly, ugly hack
        if(adapterUse.getAdapterIfKnown() == SwaRefAdapterMarker.class) {
            programElement.annotate(XmlAttachmentRef.class);
        } else {
            // [RESULT]
            // @XmlJavaTypeAdapter( Foo.class )
            programElement.annotate2(XmlJavaTypeAdapterWriter.class).value(
                adapterUse.adapterType.toType(outline,EXPOSED));
        }
    }
    if(typeUse.isCollection())
        programElement.annotate(XmlList.class);
}
 
源代码2 项目: jdk8u60   文件: TypeAndAnnotationImpl.java
public void annotate(JAnnotatable programElement) {
    if(typeUse.getAdapterUse()==null && !typeUse.isCollection())
        return; // nothing

    CAdapter adapterUse = typeUse.getAdapterUse();
    if(adapterUse!=null) {
        // ugly, ugly hack
        if(adapterUse.getAdapterIfKnown() == SwaRefAdapterMarker.class) {
            programElement.annotate(XmlAttachmentRef.class);
        } else {
            // [RESULT]
            // @XmlJavaTypeAdapter( Foo.class )
            programElement.annotate2(XmlJavaTypeAdapterWriter.class).value(
                adapterUse.adapterType.toType(outline,EXPOSED));
        }
    }
    if(typeUse.isCollection())
        programElement.annotate(XmlList.class);
}
 
源代码3 项目: openjdk-jdk8u   文件: TypeAndAnnotationImpl.java
public void annotate(JAnnotatable programElement) {
    if(typeUse.getAdapterUse()==null && !typeUse.isCollection())
        return; // nothing

    CAdapter adapterUse = typeUse.getAdapterUse();
    if(adapterUse!=null) {
        // ugly, ugly hack
        if(adapterUse.getAdapterIfKnown() == SwaRefAdapterMarker.class) {
            programElement.annotate(XmlAttachmentRef.class);
        } else {
            // [RESULT]
            // @XmlJavaTypeAdapter( Foo.class )
            programElement.annotate2(XmlJavaTypeAdapterWriter.class).value(
                adapterUse.adapterType.toType(outline,EXPOSED));
        }
    }
    if(typeUse.isCollection())
        programElement.annotate(XmlList.class);
}
 
public void annotate(JAnnotatable programElement) {
    if(typeUse.getAdapterUse()==null && !typeUse.isCollection())
        return; // nothing

    CAdapter adapterUse = typeUse.getAdapterUse();
    if(adapterUse!=null) {
        // ugly, ugly hack
        if(adapterUse.getAdapterIfKnown() == SwaRefAdapterMarker.class) {
            programElement.annotate(XmlAttachmentRef.class);
        } else {
            // [RESULT]
            // @XmlJavaTypeAdapter( Foo.class )
            programElement.annotate2(XmlJavaTypeAdapterWriter.class).value(
                adapterUse.adapterType.toType(outline,EXPOSED));
        }
    }
    if(typeUse.isCollection())
        programElement.annotate(XmlList.class);
}
 
源代码5 项目: openjdk-jdk9   文件: TypeAndAnnotationImpl.java
public void annotate(JAnnotatable programElement) {
    if(typeUse.getAdapterUse()==null && !typeUse.isCollection())
        return; // nothing

    CAdapter adapterUse = typeUse.getAdapterUse();
    if(adapterUse!=null) {
        // ugly, ugly hack
        if(adapterUse.getAdapterIfKnown() == SwaRefAdapterMarker.class) {
            programElement.annotate(XmlAttachmentRef.class);
        } else {
            // [RESULT]
            // @XmlJavaTypeAdapter( Foo.class )
            programElement.annotate2(XmlJavaTypeAdapterWriter.class).value(
                adapterUse.adapterType.toType(outline,EXPOSED));
        }
    }
    if(typeUse.isCollection())
        programElement.annotate(XmlList.class);
}
 
源代码6 项目: hottub   文件: TypeAndAnnotationImpl.java
public void annotate(JAnnotatable programElement) {
    if(typeUse.getAdapterUse()==null && !typeUse.isCollection())
        return; // nothing

    CAdapter adapterUse = typeUse.getAdapterUse();
    if(adapterUse!=null) {
        // ugly, ugly hack
        if(adapterUse.getAdapterIfKnown() == SwaRefAdapterMarker.class) {
            programElement.annotate(XmlAttachmentRef.class);
        } else {
            // [RESULT]
            // @XmlJavaTypeAdapter( Foo.class )
            programElement.annotate2(XmlJavaTypeAdapterWriter.class).value(
                adapterUse.adapterType.toType(outline,EXPOSED));
        }
    }
    if(typeUse.isCollection())
        programElement.annotate(XmlList.class);
}
 
源代码7 项目: openjdk-8-source   文件: TypeAndAnnotationImpl.java
public void annotate(JAnnotatable programElement) {
    if(typeUse.getAdapterUse()==null && !typeUse.isCollection())
        return; // nothing

    CAdapter adapterUse = typeUse.getAdapterUse();
    if(adapterUse!=null) {
        // ugly, ugly hack
        if(adapterUse.getAdapterIfKnown() == SwaRefAdapterMarker.class) {
            programElement.annotate(XmlAttachmentRef.class);
        } else {
            // [RESULT]
            // @XmlJavaTypeAdapter( Foo.class )
            programElement.annotate2(XmlJavaTypeAdapterWriter.class).value(
                adapterUse.adapterType.toType(outline,EXPOSED));
        }
    }
    if(typeUse.isCollection())
        programElement.annotate(XmlList.class);
}
 
源代码8 项目: openjdk-8   文件: TypeAndAnnotationImpl.java
public void annotate(JAnnotatable programElement) {
    if(typeUse.getAdapterUse()==null && !typeUse.isCollection())
        return; // nothing

    CAdapter adapterUse = typeUse.getAdapterUse();
    if(adapterUse!=null) {
        // ugly, ugly hack
        if(adapterUse.getAdapterIfKnown() == SwaRefAdapterMarker.class) {
            programElement.annotate(XmlAttachmentRef.class);
        } else {
            // [RESULT]
            // @XmlJavaTypeAdapter( Foo.class )
            programElement.annotate2(XmlJavaTypeAdapterWriter.class).value(
                adapterUse.adapterType.toType(outline,EXPOSED));
        }
    }
    if(typeUse.isCollection())
        programElement.annotate(XmlList.class);
}
 
源代码9 项目: cxf   文件: WrapperUtil.java
public static List<Annotation> getJaxbAnnotations(Method method) {
    List<Annotation> jaxbAnnotation = new ArrayList<>();
    Annotation ann = method.getAnnotation(XmlAttachmentRef.class);
    if (ann != null) {
        jaxbAnnotation.add(ann);
    }
    ann = method.getAnnotation(XmlMimeType.class);
    if (ann != null) {
        jaxbAnnotation.add(ann);
    }
    ann = method.getAnnotation(XmlJavaTypeAdapter.class);
    if (ann != null) {
        jaxbAnnotation.add(ann);
    }
    ann = method.getAnnotation(XmlList.class);
    if (ann != null) {
        jaxbAnnotation.add(ann);
    }
    return jaxbAnnotation;
}
 
源代码10 项目: cxf   文件: WrapperUtil.java
public static List<Annotation> getJaxbAnnotations(Method method, int idx) {
    List<Annotation> jaxbAnnotation = new ArrayList<>();
    Annotation[][] anns = method.getParameterAnnotations();
    for (int i = 0; i < method.getParameterTypes().length; i++) {
        if (i == idx) {
            for (Annotation ann : anns[i]) {
                if (ann.annotationType() == XmlAttachmentRef.class
                    || ann.annotationType() == XmlMimeType.class
                    || ann.annotationType() == XmlJavaTypeAdapter.class
                    || ann.annotationType() == XmlList.class
                    || ann.annotationType() == XmlElement.class) {
                    jaxbAnnotation.add(ann);
                }
            }
        }
    }
    return jaxbAnnotation;
}
 
源代码11 项目: cxf   文件: WrapperClassGenerator.java
private List<Annotation> getJaxbAnnos(MessagePartInfo mpi) {
    List<Annotation> list = new java.util.concurrent.CopyOnWriteArrayList<>();
    Annotation[] anns = getMethodParameterAnnotations(mpi);
    if (anns != null) {
        for (Annotation anno : anns) {
            if (anno.annotationType() == XmlList.class
                || anno.annotationType() == XmlAttachmentRef.class
                || anno.annotationType() == XmlJavaTypeAdapter.class
                || anno.annotationType() == XmlMimeType.class
                || anno.annotationType() == XmlElement.class
                || anno.annotationType() == XmlElementWrapper.class) {
                list.add(anno);
            }
        }
    }
    return list;
}
 
源代码12 项目: cxf   文件: ReflectionServiceFactoryBean.java
private Map<Class<?>, Boolean> getJaxbAnnoMap(MessagePartInfo mpi) {
    Map<Class<?>, Boolean> map = new ConcurrentHashMap<>(4, 0.75f, 1);
    Annotation[] anns = getMethodParameterAnnotations(mpi);

    if (anns != null) {
        for (Annotation anno : anns) {
            if (anno instanceof XmlList) {
                map.put(XmlList.class, true);
            }
            if (anno instanceof XmlAttachmentRef) {
                map.put(XmlAttachmentRef.class, true);
            }
            if (anno instanceof XmlJavaTypeAdapter) {
                map.put(XmlJavaTypeAdapter.class, true);
            }
            if (anno instanceof XmlElementWrapper) {
                map.put(XmlElementWrapper.class, true);
            }
        }
    }
    return map;
}
 
源代码13 项目: TencentKona-8   文件: BeanGenerator.java
/**
 * Generates {@link XmlJavaTypeAdapter} from {@link PropertyInfo} if necessary.
 * Also generates other per-property annotations
 * (such as {@link XmlID}, {@link XmlIDREF}, and {@link XmlMimeType} if necessary.
 */
public final void generateAdapterIfNecessary(CPropertyInfo prop, JAnnotatable field) {
    CAdapter adapter = prop.getAdapter();
    if (adapter != null) {
        if (adapter.getAdapterIfKnown() == SwaRefAdapterMarker.class) {
            field.annotate(XmlAttachmentRef.class);
        } else {
            // [RESULT]
            // @XmlJavaTypeAdapter( Foo.class )
            XmlJavaTypeAdapterWriter xjtw = field.annotate2(XmlJavaTypeAdapterWriter.class);
            xjtw.value(adapter.adapterType.toType(this, EXPOSED));
        }
    }

    switch (prop.id()) {
        case ID:
            field.annotate(XmlID.class);
            break;
        case IDREF:
            field.annotate(XmlIDREF.class);
            break;
    }

    if (prop.getExpectedMimeType() != null) {
        field.annotate2(XmlMimeTypeWriter.class).value(prop.getExpectedMimeType().toString());
    }
}
 
源代码14 项目: freehealth-connector   文件: ObjectFactory.java
@XmlElementDecl(
   namespace = "urn:be:fgov:ehealth:commons:enc:v2",
   name = "URI"
)
@XmlAttachmentRef
public JAXBElement<DataHandler> createURI(DataHandler value) {
   return new JAXBElement(_URI_QNAME, DataHandler.class, (Class)null, value);
}
 
源代码15 项目: freehealth-connector   文件: ObjectFactory.java
@XmlElementDecl(
   namespace = "urn:be:fgov:ehealth:commons:enc:v2",
   name = "URI"
)
@XmlAttachmentRef
public JAXBElement<DataHandler> createURI(DataHandler value) {
   return new JAXBElement(_URI_QNAME, DataHandler.class, (Class)null, value);
}
 
源代码16 项目: freehealth-connector   文件: ObjectFactory.java
@XmlElementDecl(
   namespace = "urn:be:fgov:ehealth:commons:enc:v2",
   name = "URI"
)
@XmlAttachmentRef
public JAXBElement<DataHandler> createURI(DataHandler value) {
   return new JAXBElement(_URI_QNAME, DataHandler.class, (Class)null, value);
}
 
源代码17 项目: freehealth-connector   文件: ObjectFactory.java
@XmlElementDecl(
   namespace = "urn:be:fgov:ehealth:commons:enc:v2",
   name = "URI"
)
@XmlAttachmentRef
public JAXBElement<DataHandler> createURI(DataHandler value) {
   return new JAXBElement(_URI_QNAME, DataHandler.class, (Class)null, value);
}
 
源代码18 项目: freehealth-connector   文件: ObjectFactory.java
@XmlElementDecl(
   namespace = "urn:be:fgov:ehealth:commons:enc:v2",
   name = "URI"
)
@XmlAttachmentRef
public JAXBElement<DataHandler> createURI(DataHandler value) {
   return new JAXBElement(_URI_QNAME, DataHandler.class, (Class)null, value);
}
 
源代码19 项目: jdk8u60   文件: BeanGenerator.java
/**
 * Generates {@link XmlJavaTypeAdapter} from {@link PropertyInfo} if necessary.
 * Also generates other per-property annotations
 * (such as {@link XmlID}, {@link XmlIDREF}, and {@link XmlMimeType} if necessary.
 */
public final void generateAdapterIfNecessary(CPropertyInfo prop, JAnnotatable field) {
    CAdapter adapter = prop.getAdapter();
    if (adapter != null) {
        if (adapter.getAdapterIfKnown() == SwaRefAdapterMarker.class) {
            field.annotate(XmlAttachmentRef.class);
        } else {
            // [RESULT]
            // @XmlJavaTypeAdapter( Foo.class )
            XmlJavaTypeAdapterWriter xjtw = field.annotate2(XmlJavaTypeAdapterWriter.class);
            xjtw.value(adapter.adapterType.toType(this, EXPOSED));
        }
    }

    switch (prop.id()) {
        case ID:
            field.annotate(XmlID.class);
            break;
        case IDREF:
            field.annotate(XmlIDREF.class);
            break;
    }

    if (prop.getExpectedMimeType() != null) {
        field.annotate2(XmlMimeTypeWriter.class).value(prop.getExpectedMimeType().toString());
    }
}
 
源代码20 项目: openjdk-jdk8u   文件: BeanGenerator.java
/**
 * Generates {@link XmlJavaTypeAdapter} from {@link PropertyInfo} if necessary.
 * Also generates other per-property annotations
 * (such as {@link XmlID}, {@link XmlIDREF}, and {@link XmlMimeType} if necessary.
 */
public final void generateAdapterIfNecessary(CPropertyInfo prop, JAnnotatable field) {
    CAdapter adapter = prop.getAdapter();
    if (adapter != null) {
        if (adapter.getAdapterIfKnown() == SwaRefAdapterMarker.class) {
            field.annotate(XmlAttachmentRef.class);
        } else {
            // [RESULT]
            // @XmlJavaTypeAdapter( Foo.class )
            XmlJavaTypeAdapterWriter xjtw = field.annotate2(XmlJavaTypeAdapterWriter.class);
            xjtw.value(adapter.adapterType.toType(this, EXPOSED));
        }
    }

    switch (prop.id()) {
        case ID:
            field.annotate(XmlID.class);
            break;
        case IDREF:
            field.annotate(XmlIDREF.class);
            break;
    }

    if (prop.getExpectedMimeType() != null) {
        field.annotate2(XmlMimeTypeWriter.class).value(prop.getExpectedMimeType().toString());
    }
}
 
源代码21 项目: openjdk-jdk8u-backup   文件: BeanGenerator.java
/**
 * Generates {@link XmlJavaTypeAdapter} from {@link PropertyInfo} if necessary.
 * Also generates other per-property annotations
 * (such as {@link XmlID}, {@link XmlIDREF}, and {@link XmlMimeType} if necessary.
 */
public final void generateAdapterIfNecessary(CPropertyInfo prop, JAnnotatable field) {
    CAdapter adapter = prop.getAdapter();
    if (adapter != null) {
        if (adapter.getAdapterIfKnown() == SwaRefAdapterMarker.class) {
            field.annotate(XmlAttachmentRef.class);
        } else {
            // [RESULT]
            // @XmlJavaTypeAdapter( Foo.class )
            XmlJavaTypeAdapterWriter xjtw = field.annotate2(XmlJavaTypeAdapterWriter.class);
            xjtw.value(adapter.adapterType.toType(this, EXPOSED));
        }
    }

    switch (prop.id()) {
        case ID:
            field.annotate(XmlID.class);
            break;
        case IDREF:
            field.annotate(XmlIDREF.class);
            break;
    }

    if (prop.getExpectedMimeType() != null) {
        field.annotate2(XmlMimeTypeWriter.class).value(prop.getExpectedMimeType().toString());
    }
}
 
源代码22 项目: openjdk-jdk9   文件: BeanGenerator.java
/**
 * Generates {@link XmlJavaTypeAdapter} from {@link PropertyInfo} if necessary.
 * Also generates other per-property annotations
 * (such as {@link XmlID}, {@link XmlIDREF}, and {@link XmlMimeType} if necessary.
 */
public final void generateAdapterIfNecessary(CPropertyInfo prop, JAnnotatable field) {
    CAdapter adapter = prop.getAdapter();
    if (adapter != null) {
        if (adapter.getAdapterIfKnown() == SwaRefAdapterMarker.class) {
            field.annotate(XmlAttachmentRef.class);
        } else {
            // [RESULT]
            // @XmlJavaTypeAdapter( Foo.class )
            XmlJavaTypeAdapterWriter xjtw = field.annotate2(XmlJavaTypeAdapterWriter.class);
            xjtw.value(adapter.adapterType.toType(this, EXPOSED));
        }
    }

    switch (prop.id()) {
        case ID:
            field.annotate(XmlID.class);
            break;
        case IDREF:
            field.annotate(XmlIDREF.class);
            break;
    }

    if (prop.getExpectedMimeType() != null) {
        field.annotate2(XmlMimeTypeWriter.class).value(prop.getExpectedMimeType().toString());
    }
}
 
源代码23 项目: hottub   文件: BeanGenerator.java
/**
 * Generates {@link XmlJavaTypeAdapter} from {@link PropertyInfo} if necessary.
 * Also generates other per-property annotations
 * (such as {@link XmlID}, {@link XmlIDREF}, and {@link XmlMimeType} if necessary.
 */
public final void generateAdapterIfNecessary(CPropertyInfo prop, JAnnotatable field) {
    CAdapter adapter = prop.getAdapter();
    if (adapter != null) {
        if (adapter.getAdapterIfKnown() == SwaRefAdapterMarker.class) {
            field.annotate(XmlAttachmentRef.class);
        } else {
            // [RESULT]
            // @XmlJavaTypeAdapter( Foo.class )
            XmlJavaTypeAdapterWriter xjtw = field.annotate2(XmlJavaTypeAdapterWriter.class);
            xjtw.value(adapter.adapterType.toType(this, EXPOSED));
        }
    }

    switch (prop.id()) {
        case ID:
            field.annotate(XmlID.class);
            break;
        case IDREF:
            field.annotate(XmlIDREF.class);
            break;
    }

    if (prop.getExpectedMimeType() != null) {
        field.annotate2(XmlMimeTypeWriter.class).value(prop.getExpectedMimeType().toString());
    }
}
 
源代码24 项目: openjdk-8-source   文件: BeanGenerator.java
/**
 * Generates {@link XmlJavaTypeAdapter} from {@link PropertyInfo} if necessary.
 * Also generates other per-property annotations
 * (such as {@link XmlID}, {@link XmlIDREF}, and {@link XmlMimeType} if necessary.
 */
public final void generateAdapterIfNecessary(CPropertyInfo prop, JAnnotatable field) {
    CAdapter adapter = prop.getAdapter();
    if (adapter != null) {
        if (adapter.getAdapterIfKnown() == SwaRefAdapterMarker.class) {
            field.annotate(XmlAttachmentRef.class);
        } else {
            // [RESULT]
            // @XmlJavaTypeAdapter( Foo.class )
            XmlJavaTypeAdapterWriter xjtw = field.annotate2(XmlJavaTypeAdapterWriter.class);
            xjtw.value(adapter.adapterType.toType(this, EXPOSED));
        }
    }

    switch (prop.id()) {
        case ID:
            field.annotate(XmlID.class);
            break;
        case IDREF:
            field.annotate(XmlIDREF.class);
            break;
    }

    if (prop.getExpectedMimeType() != null) {
        field.annotate2(XmlMimeTypeWriter.class).value(prop.getExpectedMimeType().toString());
    }
}
 
源代码25 项目: openjdk-8   文件: BeanGenerator.java
/**
 * Generates {@link XmlJavaTypeAdapter} from {@link PropertyInfo} if necessary.
 * Also generates other per-property annotations
 * (such as {@link XmlID}, {@link XmlIDREF}, and {@link XmlMimeType} if necessary.
 */
public final void generateAdapterIfNecessary(CPropertyInfo prop, JAnnotatable field) {
    CAdapter adapter = prop.getAdapter();
    if (adapter != null) {
        if (adapter.getAdapterIfKnown() == SwaRefAdapterMarker.class) {
            field.annotate(XmlAttachmentRef.class);
        } else {
            // [RESULT]
            // @XmlJavaTypeAdapter( Foo.class )
            XmlJavaTypeAdapterWriter xjtw = field.annotate2(XmlJavaTypeAdapterWriter.class);
            xjtw.value(adapter.adapterType.toType(this, EXPOSED));
        }
    }

    switch (prop.id()) {
        case ID:
            field.annotate(XmlID.class);
            break;
        case IDREF:
            field.annotate(XmlIDREF.class);
            break;
    }

    if (prop.getExpectedMimeType() != null) {
        field.annotate2(XmlMimeTypeWriter.class).value(prop.getExpectedMimeType().toString());
    }
}
 
源代码26 项目: cxf   文件: JAXBDataBase.java
private List<Annotation> extractJAXBAnnotations(Annotation[] anns) {
    List<Annotation> annoList = null;
    if (anns != null) {
        for (Annotation ann : anns) {
            if (ann instanceof XmlList || ann instanceof XmlAttachmentRef
                || ann instanceof XmlJavaTypeAdapter) {
                if (annoList == null) {
                    annoList = new ArrayList<>();
                }
                annoList.add(ann);
            }
        }
    }
    return annoList;
}
 
源代码27 项目: TencentKona-8   文件: PropertyInfoImpl.java
protected PropertyInfoImpl(ClassInfoImpl<T,C,F,M> parent, PropertySeed<T,C,F,M> spi) {
    this.seed = spi;
    this.parent = parent;

    if(parent==null)
        /*
            Various people reported a bug where this parameter is somehow null.
            In an attempt to catch the error better, let's do an explicit check here.

            http://forums.java.net/jive/thread.jspa?threadID=18479
            http://forums.java.net/jive/thread.jspa?messageID=165946
         */
        throw new AssertionError();

    MimeType mt = Util.calcExpectedMediaType(seed,parent.builder);
    if(mt!=null && !kind().canHaveXmlMimeType) {
        parent.builder.reportError(new IllegalAnnotationException(
            Messages.ILLEGAL_ANNOTATION.format(XmlMimeType.class.getName()),
            seed.readAnnotation(XmlMimeType.class)
        ));
        mt = null;
    }
    this.expectedMimeType = mt;
    this.inlineBinary = seed.hasAnnotation(XmlInlineBinaryData.class);

    T t = seed.getRawType();

    // check if there's an adapter applicable to the whole property
    XmlJavaTypeAdapter xjta = getApplicableAdapter(t);
    if(xjta!=null) {
        isCollection = false;
        adapter = new Adapter<T,C>(xjta,reader(),nav());
    } else {
        // check if the adapter is applicable to the individual item in the property

        this.isCollection = nav().isSubClassOf(t, nav().ref(Collection.class))
                         || nav().isArrayButNotByteArray(t);

        xjta = getApplicableAdapter(getIndividualType());
        if(xjta==null) {
            // ugly ugly hack, but we implement swaRef as adapter
            XmlAttachmentRef xsa = seed.readAnnotation(XmlAttachmentRef.class);
            if(xsa!=null) {
                parent.builder.hasSwaRef = true;
                adapter = new Adapter<T,C>(nav().asDecl(SwaRefAdapter.class),nav());
            } else {
                adapter = null;

                // if this field has adapter annotation but not applicable,
                // that must be an error of the user
                xjta = seed.readAnnotation(XmlJavaTypeAdapter.class);
                if(xjta!=null) {
                    T ad = reader().getClassValue(xjta,"value");
                    parent.builder.reportError(new IllegalAnnotationException(
                        Messages.UNMATCHABLE_ADAPTER.format(
                                nav().getTypeName(ad), nav().getTypeName(t)),
                        xjta
                    ));
                }
            }
        } else {
            adapter = new Adapter<T,C>(xjta,reader(),nav());
        }
    }

    this.id = calcId();
    this.schemaType = Util.calcSchemaType(reader(),seed,parent.clazz,
            getIndividualType(),this);
}
 
源代码28 项目: jdk8u60   文件: PropertyInfoImpl.java
protected PropertyInfoImpl(ClassInfoImpl<T,C,F,M> parent, PropertySeed<T,C,F,M> spi) {
    this.seed = spi;
    this.parent = parent;

    if(parent==null)
        /*
            Various people reported a bug where this parameter is somehow null.
            In an attempt to catch the error better, let's do an explicit check here.

            http://forums.java.net/jive/thread.jspa?threadID=18479
            http://forums.java.net/jive/thread.jspa?messageID=165946
         */
        throw new AssertionError();

    MimeType mt = Util.calcExpectedMediaType(seed,parent.builder);
    if(mt!=null && !kind().canHaveXmlMimeType) {
        parent.builder.reportError(new IllegalAnnotationException(
            Messages.ILLEGAL_ANNOTATION.format(XmlMimeType.class.getName()),
            seed.readAnnotation(XmlMimeType.class)
        ));
        mt = null;
    }
    this.expectedMimeType = mt;
    this.inlineBinary = seed.hasAnnotation(XmlInlineBinaryData.class);

    T t = seed.getRawType();

    // check if there's an adapter applicable to the whole property
    XmlJavaTypeAdapter xjta = getApplicableAdapter(t);
    if(xjta!=null) {
        isCollection = false;
        adapter = new Adapter<T,C>(xjta,reader(),nav());
    } else {
        // check if the adapter is applicable to the individual item in the property

        this.isCollection = nav().isSubClassOf(t, nav().ref(Collection.class))
                         || nav().isArrayButNotByteArray(t);

        xjta = getApplicableAdapter(getIndividualType());
        if(xjta==null) {
            // ugly ugly hack, but we implement swaRef as adapter
            XmlAttachmentRef xsa = seed.readAnnotation(XmlAttachmentRef.class);
            if(xsa!=null) {
                parent.builder.hasSwaRef = true;
                adapter = new Adapter<T,C>(nav().asDecl(SwaRefAdapter.class),nav());
            } else {
                adapter = null;

                // if this field has adapter annotation but not applicable,
                // that must be an error of the user
                xjta = seed.readAnnotation(XmlJavaTypeAdapter.class);
                if(xjta!=null) {
                    T ad = reader().getClassValue(xjta,"value");
                    parent.builder.reportError(new IllegalAnnotationException(
                        Messages.UNMATCHABLE_ADAPTER.format(
                                nav().getTypeName(ad), nav().getTypeName(t)),
                        xjta
                    ));
                }
            }
        } else {
            adapter = new Adapter<T,C>(xjta,reader(),nav());
        }
    }

    this.id = calcId();
    this.schemaType = Util.calcSchemaType(reader(),seed,parent.clazz,
            getIndividualType(),this);
}
 
源代码29 项目: openjdk-jdk8u   文件: PropertyInfoImpl.java
protected PropertyInfoImpl(ClassInfoImpl<T,C,F,M> parent, PropertySeed<T,C,F,M> spi) {
    this.seed = spi;
    this.parent = parent;

    if(parent==null)
        /*
            Various people reported a bug where this parameter is somehow null.
            In an attempt to catch the error better, let's do an explicit check here.

            http://forums.java.net/jive/thread.jspa?threadID=18479
            http://forums.java.net/jive/thread.jspa?messageID=165946
         */
        throw new AssertionError();

    MimeType mt = Util.calcExpectedMediaType(seed,parent.builder);
    if(mt!=null && !kind().canHaveXmlMimeType) {
        parent.builder.reportError(new IllegalAnnotationException(
            Messages.ILLEGAL_ANNOTATION.format(XmlMimeType.class.getName()),
            seed.readAnnotation(XmlMimeType.class)
        ));
        mt = null;
    }
    this.expectedMimeType = mt;
    this.inlineBinary = seed.hasAnnotation(XmlInlineBinaryData.class);

    T t = seed.getRawType();

    // check if there's an adapter applicable to the whole property
    XmlJavaTypeAdapter xjta = getApplicableAdapter(t);
    if(xjta!=null) {
        isCollection = false;
        adapter = new Adapter<T,C>(xjta,reader(),nav());
    } else {
        // check if the adapter is applicable to the individual item in the property

        this.isCollection = nav().isSubClassOf(t, nav().ref(Collection.class))
                         || nav().isArrayButNotByteArray(t);

        xjta = getApplicableAdapter(getIndividualType());
        if(xjta==null) {
            // ugly ugly hack, but we implement swaRef as adapter
            XmlAttachmentRef xsa = seed.readAnnotation(XmlAttachmentRef.class);
            if(xsa!=null) {
                parent.builder.hasSwaRef = true;
                adapter = new Adapter<T,C>(nav().asDecl(SwaRefAdapter.class),nav());
            } else {
                adapter = null;

                // if this field has adapter annotation but not applicable,
                // that must be an error of the user
                xjta = seed.readAnnotation(XmlJavaTypeAdapter.class);
                if(xjta!=null) {
                    T ad = reader().getClassValue(xjta,"value");
                    parent.builder.reportError(new IllegalAnnotationException(
                        Messages.UNMATCHABLE_ADAPTER.format(
                                nav().getTypeName(ad), nav().getTypeName(t)),
                        xjta
                    ));
                }
            }
        } else {
            adapter = new Adapter<T,C>(xjta,reader(),nav());
        }
    }

    this.id = calcId();
    this.schemaType = Util.calcSchemaType(reader(),seed,parent.clazz,
            getIndividualType(),this);
}
 
源代码30 项目: openjdk-jdk8u-backup   文件: PropertyInfoImpl.java
protected PropertyInfoImpl(ClassInfoImpl<T,C,F,M> parent, PropertySeed<T,C,F,M> spi) {
    this.seed = spi;
    this.parent = parent;

    if(parent==null)
        /*
            Various people reported a bug where this parameter is somehow null.
            In an attempt to catch the error better, let's do an explicit check here.

            http://forums.java.net/jive/thread.jspa?threadID=18479
            http://forums.java.net/jive/thread.jspa?messageID=165946
         */
        throw new AssertionError();

    MimeType mt = Util.calcExpectedMediaType(seed,parent.builder);
    if(mt!=null && !kind().canHaveXmlMimeType) {
        parent.builder.reportError(new IllegalAnnotationException(
            Messages.ILLEGAL_ANNOTATION.format(XmlMimeType.class.getName()),
            seed.readAnnotation(XmlMimeType.class)
        ));
        mt = null;
    }
    this.expectedMimeType = mt;
    this.inlineBinary = seed.hasAnnotation(XmlInlineBinaryData.class);

    T t = seed.getRawType();

    // check if there's an adapter applicable to the whole property
    XmlJavaTypeAdapter xjta = getApplicableAdapter(t);
    if(xjta!=null) {
        isCollection = false;
        adapter = new Adapter<T,C>(xjta,reader(),nav());
    } else {
        // check if the adapter is applicable to the individual item in the property

        this.isCollection = nav().isSubClassOf(t, nav().ref(Collection.class))
                         || nav().isArrayButNotByteArray(t);

        xjta = getApplicableAdapter(getIndividualType());
        if(xjta==null) {
            // ugly ugly hack, but we implement swaRef as adapter
            XmlAttachmentRef xsa = seed.readAnnotation(XmlAttachmentRef.class);
            if(xsa!=null) {
                parent.builder.hasSwaRef = true;
                adapter = new Adapter<T,C>(nav().asDecl(SwaRefAdapter.class),nav());
            } else {
                adapter = null;

                // if this field has adapter annotation but not applicable,
                // that must be an error of the user
                xjta = seed.readAnnotation(XmlJavaTypeAdapter.class);
                if(xjta!=null) {
                    T ad = reader().getClassValue(xjta,"value");
                    parent.builder.reportError(new IllegalAnnotationException(
                        Messages.UNMATCHABLE_ADAPTER.format(
                                nav().getTypeName(ad), nav().getTypeName(t)),
                        xjta
                    ));
                }
            }
        } else {
            adapter = new Adapter<T,C>(xjta,reader(),nav());
        }
    }

    this.id = calcId();
    this.schemaType = Util.calcSchemaType(reader(),seed,parent.clazz,
            getIndividualType(),this);
}
 
 同包方法