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

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

源代码1 项目: TencentKona-8   文件: AbstractField.java
/**
 * Annotate the field according to the recipes given as {@link CPropertyInfo}.
 */
protected void annotate( JAnnotatable field ) {

    assert(field!=null);

    /*
    TODO: consider moving this logic to somewhere else
    so that it can be better shared, for how a field gets
    annotated doesn't really depend on how we generate accessors.

    so perhaps we should separate those two.
    */

    // TODO: consider a visitor
    if (prop instanceof CAttributePropertyInfo) {
        annotateAttribute(field);
    } else if (prop instanceof CElementPropertyInfo) {
        annotateElement(field);
    } else if (prop instanceof CValuePropertyInfo) {
        field.annotate(XmlValue.class);
    } else if (prop instanceof CReferencePropertyInfo) {
        annotateReference(field);
    }

    outline.parent().generateAdapterIfNecessary(prop,field);

    QName st = prop.getSchemaType();
    if(st!=null)
        field.annotate2(XmlSchemaTypeWriter.class)
            .name(st.getLocalPart())
            .namespace(st.getNamespaceURI());

    if(prop.inlineBinaryData())
        field.annotate(XmlInlineBinaryData.class);
}
 
源代码2 项目: jdk8u60   文件: AbstractField.java
/**
 * Annotate the field according to the recipes given as {@link CPropertyInfo}.
 */
protected void annotate( JAnnotatable field ) {

    assert(field!=null);

    /*
    TODO: consider moving this logic to somewhere else
    so that it can be better shared, for how a field gets
    annotated doesn't really depend on how we generate accessors.

    so perhaps we should separate those two.
    */

    // TODO: consider a visitor
    if (prop instanceof CAttributePropertyInfo) {
        annotateAttribute(field);
    } else if (prop instanceof CElementPropertyInfo) {
        annotateElement(field);
    } else if (prop instanceof CValuePropertyInfo) {
        field.annotate(XmlValue.class);
    } else if (prop instanceof CReferencePropertyInfo) {
        annotateReference(field);
    }

    outline.parent().generateAdapterIfNecessary(prop,field);

    QName st = prop.getSchemaType();
    if(st!=null)
        field.annotate2(XmlSchemaTypeWriter.class)
            .name(st.getLocalPart())
            .namespace(st.getNamespaceURI());

    if(prop.inlineBinaryData())
        field.annotate(XmlInlineBinaryData.class);
}
 
源代码3 项目: openjdk-jdk8u   文件: AbstractField.java
/**
 * Annotate the field according to the recipes given as {@link CPropertyInfo}.
 */
protected void annotate( JAnnotatable field ) {

    assert(field!=null);

    /*
    TODO: consider moving this logic to somewhere else
    so that it can be better shared, for how a field gets
    annotated doesn't really depend on how we generate accessors.

    so perhaps we should separate those two.
    */

    // TODO: consider a visitor
    if (prop instanceof CAttributePropertyInfo) {
        annotateAttribute(field);
    } else if (prop instanceof CElementPropertyInfo) {
        annotateElement(field);
    } else if (prop instanceof CValuePropertyInfo) {
        field.annotate(XmlValue.class);
    } else if (prop instanceof CReferencePropertyInfo) {
        annotateReference(field);
    }

    outline.parent().generateAdapterIfNecessary(prop,field);

    QName st = prop.getSchemaType();
    if(st!=null)
        field.annotate2(XmlSchemaTypeWriter.class)
            .name(st.getLocalPart())
            .namespace(st.getNamespaceURI());

    if(prop.inlineBinaryData())
        field.annotate(XmlInlineBinaryData.class);
}
 
源代码4 项目: openjdk-jdk8u-backup   文件: AbstractField.java
/**
 * Annotate the field according to the recipes given as {@link CPropertyInfo}.
 */
protected void annotate( JAnnotatable field ) {

    assert(field!=null);

    /*
    TODO: consider moving this logic to somewhere else
    so that it can be better shared, for how a field gets
    annotated doesn't really depend on how we generate accessors.

    so perhaps we should separate those two.
    */

    // TODO: consider a visitor
    if (prop instanceof CAttributePropertyInfo) {
        annotateAttribute(field);
    } else if (prop instanceof CElementPropertyInfo) {
        annotateElement(field);
    } else if (prop instanceof CValuePropertyInfo) {
        field.annotate(XmlValue.class);
    } else if (prop instanceof CReferencePropertyInfo) {
        annotateReference(field);
    }

    outline.parent().generateAdapterIfNecessary(prop,field);

    QName st = prop.getSchemaType();
    if(st!=null)
        field.annotate2(XmlSchemaTypeWriter.class)
            .name(st.getLocalPart())
            .namespace(st.getNamespaceURI());

    if(prop.inlineBinaryData())
        field.annotate(XmlInlineBinaryData.class);
}
 
源代码5 项目: openjdk-jdk9   文件: AbstractField.java
/**
 * Annotate the field according to the recipes given as {@link CPropertyInfo}.
 */
protected void annotate( JAnnotatable field ) {

    assert(field!=null);

    /*
    TODO: consider moving this logic to somewhere else
    so that it can be better shared, for how a field gets
    annotated doesn't really depend on how we generate accessors.

    so perhaps we should separate those two.
    */

    // TODO: consider a visitor
    if (prop instanceof CAttributePropertyInfo) {
        annotateAttribute(field);
    } else if (prop instanceof CElementPropertyInfo) {
        annotateElement(field);
    } else if (prop instanceof CValuePropertyInfo) {
        field.annotate(XmlValue.class);
    } else if (prop instanceof CReferencePropertyInfo) {
        annotateReference(field);
    }

    outline.parent().generateAdapterIfNecessary(prop,field);

    QName st = prop.getSchemaType();
    if(st!=null)
        field.annotate2(XmlSchemaTypeWriter.class)
            .name(st.getLocalPart())
            .namespace(st.getNamespaceURI());

    if(prop.inlineBinaryData())
        field.annotate(XmlInlineBinaryData.class);
}
 
源代码6 项目: hottub   文件: AbstractField.java
/**
 * Annotate the field according to the recipes given as {@link CPropertyInfo}.
 */
protected void annotate( JAnnotatable field ) {

    assert(field!=null);

    /*
    TODO: consider moving this logic to somewhere else
    so that it can be better shared, for how a field gets
    annotated doesn't really depend on how we generate accessors.

    so perhaps we should separate those two.
    */

    // TODO: consider a visitor
    if (prop instanceof CAttributePropertyInfo) {
        annotateAttribute(field);
    } else if (prop instanceof CElementPropertyInfo) {
        annotateElement(field);
    } else if (prop instanceof CValuePropertyInfo) {
        field.annotate(XmlValue.class);
    } else if (prop instanceof CReferencePropertyInfo) {
        annotateReference(field);
    }

    outline.parent().generateAdapterIfNecessary(prop,field);

    QName st = prop.getSchemaType();
    if(st!=null)
        field.annotate2(XmlSchemaTypeWriter.class)
            .name(st.getLocalPart())
            .namespace(st.getNamespaceURI());

    if(prop.inlineBinaryData())
        field.annotate(XmlInlineBinaryData.class);
}
 
源代码7 项目: openjdk-8-source   文件: AbstractField.java
/**
 * Annotate the field according to the recipes given as {@link CPropertyInfo}.
 */
protected void annotate( JAnnotatable field ) {

    assert(field!=null);

    /*
    TODO: consider moving this logic to somewhere else
    so that it can be better shared, for how a field gets
    annotated doesn't really depend on how we generate accessors.

    so perhaps we should separate those two.
    */

    // TODO: consider a visitor
    if (prop instanceof CAttributePropertyInfo) {
        annotateAttribute(field);
    } else if (prop instanceof CElementPropertyInfo) {
        annotateElement(field);
    } else if (prop instanceof CValuePropertyInfo) {
        field.annotate(XmlValue.class);
    } else if (prop instanceof CReferencePropertyInfo) {
        annotateReference(field);
    }

    outline.parent().generateAdapterIfNecessary(prop,field);

    QName st = prop.getSchemaType();
    if(st!=null)
        field.annotate2(XmlSchemaTypeWriter.class)
            .name(st.getLocalPart())
            .namespace(st.getNamespaceURI());

    if(prop.inlineBinaryData())
        field.annotate(XmlInlineBinaryData.class);
}
 
源代码8 项目: openjdk-8   文件: AbstractField.java
/**
 * Annotate the field according to the recipes given as {@link CPropertyInfo}.
 */
protected void annotate( JAnnotatable field ) {

    assert(field!=null);

    /*
    TODO: consider moving this logic to somewhere else
    so that it can be better shared, for how a field gets
    annotated doesn't really depend on how we generate accessors.

    so perhaps we should separate those two.
    */

    // TODO: consider a visitor
    if (prop instanceof CAttributePropertyInfo) {
        annotateAttribute(field);
    } else if (prop instanceof CElementPropertyInfo) {
        annotateElement(field);
    } else if (prop instanceof CValuePropertyInfo) {
        field.annotate(XmlValue.class);
    } else if (prop instanceof CReferencePropertyInfo) {
        annotateReference(field);
    }

    outline.parent().generateAdapterIfNecessary(prop,field);

    QName st = prop.getSchemaType();
    if(st!=null)
        field.annotate2(XmlSchemaTypeWriter.class)
            .name(st.getLocalPart())
            .namespace(st.getNamespaceURI());

    if(prop.inlineBinaryData())
        field.annotate(XmlInlineBinaryData.class);
}
 
源代码9 项目: 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);
}
 
源代码10 项目: 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);
}
 
源代码11 项目: tessera   文件: StoreRawRequest.java
@XmlInlineBinaryData
public byte[] getPayload() {
    return payload;
}
 
源代码12 项目: 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);
}
 
源代码13 项目: 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);
}
 
源代码14 项目: openjdk-jdk9   文件: 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);
}
 
源代码15 项目: hottub   文件: 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);
}
 
源代码16 项目: openjdk-8-source   文件: 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);
}
 
源代码17 项目: openjdk-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);
}
 
 同包方法