Java 类javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter 实例源码

项目:OpenJSharp    文件:PropertyInfoImpl.java   
/**
 * Checks if the given adapter is applicable to the declared property type.
 */
private boolean isApplicable(XmlJavaTypeAdapter jta, T declaredType ) {
    if(jta==null)   return false;

    T type = reader().getClassValue(jta,"type");
    if(nav().isSameType(declaredType, type))
        return true;    // for types explicitly marked in XmlJavaTypeAdapter.type()

    T ad = reader().getClassValue(jta,"value");
    T ba = nav().getBaseClass(ad, nav().asDecl(XmlAdapter.class));
    if(!nav().isParameterizedType(ba))
        return true;   // can't check type applicability. assume Object, which means applicable to any.
    T inMemType = nav().getTypeArgument(ba, 1);

    return nav().isSubClassOf(declaredType,inMemType);
}
项目:openjdk-jdk10    文件:PropertyInfoImpl.java   
/**
 * Checks if the given adapter is applicable to the declared property type.
 */
private boolean isApplicable(XmlJavaTypeAdapter jta, T declaredType ) {
    if(jta==null)   return false;

    T type = reader().getClassValue(jta,"type");
    if(nav().isSameType(declaredType, type))
        return true;    // for types explicitly marked in XmlJavaTypeAdapter.type()

    T ad = reader().getClassValue(jta,"value");
    T ba = nav().getBaseClass(ad, nav().asDecl(XmlAdapter.class));
    if(!nav().isParameterizedType(ba))
        return true;   // can't check type applicability. assume Object, which means applicable to any.
    T inMemType = nav().getTypeArgument(ba, 1);

    return nav().isSubClassOf(declaredType,inMemType);
}
项目:oscm    文件:ObjectFactory.java   
/**
 * Create an instance of {@link JAXBElement }{@code <}{@link String }{@code >}
 * 
 */
@XmlElementDecl(namespace = "urn:oasis:names:tc:SAML:2.0:assertion", name = "AssertionIDRef")
@XmlJavaTypeAdapter(CollapsedStringAdapter.class)
public JAXBElement<String> createAssertionIDRef(String value) {
    return new JAXBElement<String>(_AssertionIDRef_QNAME, String.class,
            null, value);
}
项目:OpenJSharp    文件:PropertyInfoImpl.java   
private XmlJavaTypeAdapter getApplicableAdapter(T type) {
    XmlJavaTypeAdapter jta = seed.readAnnotation(XmlJavaTypeAdapter.class);
    if(jta!=null && isApplicable(jta,type))
        return jta;

    // check the applicable adapters on the package
    XmlJavaTypeAdapters jtas = reader().getPackageAnnotation(XmlJavaTypeAdapters.class, parent.clazz, seed );
    if(jtas!=null) {
        for (XmlJavaTypeAdapter xjta : jtas.value()) {
            if(isApplicable(xjta,type))
                return xjta;
        }
    }
    jta = reader().getPackageAnnotation(XmlJavaTypeAdapter.class, parent.clazz, seed );
    if(isApplicable(jta,type))
        return jta;

    // then on the target class
    C refType = nav().asDecl(type);
    if(refType!=null) {
        jta = reader().getClassAnnotation(XmlJavaTypeAdapter.class, refType, seed );
        if(jta!=null && isApplicable(jta,type)) // the one on the type always apply.
            return jta;
    }

    return null;
}
项目:OpenJSharp    文件:Adapter.java   
public Adapter(
    XmlJavaTypeAdapter spec,
    AnnotationReader<TypeT,ClassDeclT,?,?> reader,
    Navigator<TypeT,ClassDeclT,?,?> nav) {

    this( nav.asDecl(reader.getClassValue(spec,"value")), nav );
}
项目:OpenJSharp    文件:Ref.java   
public Ref(AnnotationReader<T,C,?,?> reader,
           Navigator<T,C,?,?> nav,
           T type, XmlJavaTypeAdapter xjta, XmlList xl ) {
    Adapter<T,C> adapter=null;
    if(xjta!=null) {
        adapter = new Adapter<T,C>(xjta,reader,nav);
        type = adapter.defaultType;
    }

    this.type = type;
    this.adapter = adapter;
    this.valueList = xl!=null;
}
项目:OpenJSharp    文件:JAXBContextImpl.java   
private NonElement<Type,Class> getXmlType(RuntimeTypeInfoSet tis, TypeReference tr) {
    if(tr==null)
        throw new IllegalArgumentException();

    XmlJavaTypeAdapter xjta = tr.get(XmlJavaTypeAdapter.class);
    XmlList xl = tr.get(XmlList.class);

    Ref<Type,Class> ref = new Ref<Type,Class>(annotationReader, tis.getNavigator(), tr.type, xjta, xl );

    return tis.getTypeInfo(ref);
}
项目:OpenJSharp    文件:JavaCompilerImpl.java   
public J2SJAXBModel bind(
    Collection<Reference> rootClasses,
    Map<QName,Reference> additionalElementDecls,
    String defaultNamespaceRemap,
    ProcessingEnvironment env) {

    ModelBuilder<TypeMirror, TypeElement, VariableElement, ExecutableElement> builder =
            new ModelBuilder<TypeMirror, TypeElement, VariableElement, ExecutableElement>(
            InlineAnnotationReaderImpl.theInstance,
            new ApNavigator(env),
            Collections.<TypeElement, TypeElement>emptyMap(),
            defaultNamespaceRemap );

    builder.setErrorHandler(new ErrorHandlerImpl(env.getMessager()));

    for ( Reference ref : rootClasses ) {
        TypeMirror t = ref.type;

        XmlJavaTypeAdapter xjta = ref.annotations.getAnnotation(XmlJavaTypeAdapter.class);
        XmlList xl = ref.annotations.getAnnotation(XmlList.class);

        builder.getTypeInfo(new Ref<TypeMirror, TypeElement>(builder, t, xjta, xl));
    }

    TypeInfoSet<TypeMirror, TypeElement, VariableElement, ExecutableElement> r = builder.link();
    if(r==null)     return null;

    if(additionalElementDecls==null)
        additionalElementDecls = Collections.emptyMap();
    else {
        // fool proof check
        for (Map.Entry<QName, ? extends Reference> e : additionalElementDecls.entrySet()) {
            if(e.getKey()==null)
                throw new IllegalArgumentException("nulls in additionalElementDecls");
        }
    }
    return new JAXBModelImpl(r, builder.reader, rootClasses, new HashMap<QName, Reference>(additionalElementDecls));
}
项目:OpenJSharp    文件:JAXBModelImpl.java   
private NonElement<TypeMirror, TypeElement> getXmlType(Reference r) {
    if(r==null)
        throw new IllegalArgumentException();

    XmlJavaTypeAdapter xjta = r.annotations.getAnnotation(XmlJavaTypeAdapter.class);
    XmlList xl = r.annotations.getAnnotation(XmlList.class);

    Ref<TypeMirror, TypeElement> ref = new Ref<TypeMirror, TypeElement>(
        reader,types.getNavigator(),r.type,xjta,xl);

    return types.getTypeInfo(ref);
}
项目:openjdk-jdk10    文件:JavaCompilerImpl.java   
public J2SJAXBModel bind(
    Collection<Reference> rootClasses,
    Map<QName,Reference> additionalElementDecls,
    String defaultNamespaceRemap,
    ProcessingEnvironment env) {

    ModelBuilder<TypeMirror, TypeElement, VariableElement, ExecutableElement> builder =
            new ModelBuilder<TypeMirror, TypeElement, VariableElement, ExecutableElement>(
            InlineAnnotationReaderImpl.theInstance,
            new ApNavigator(env),
            Collections.<TypeElement, TypeElement>emptyMap(),
            defaultNamespaceRemap );

    builder.setErrorHandler(new ErrorHandlerImpl(env.getMessager()));

    for ( Reference ref : rootClasses ) {
        TypeMirror t = ref.type;

        XmlJavaTypeAdapter xjta = ref.annotations.getAnnotation(XmlJavaTypeAdapter.class);
        XmlList xl = ref.annotations.getAnnotation(XmlList.class);

        builder.getTypeInfo(new Ref<TypeMirror, TypeElement>(builder, t, xjta, xl));
    }

    TypeInfoSet<TypeMirror, TypeElement, VariableElement, ExecutableElement> r = builder.link();
    if(r==null)     return null;

    if(additionalElementDecls==null)
        additionalElementDecls = Collections.emptyMap();
    else {
        // fool proof check
        for (Map.Entry<QName, ? extends Reference> e : additionalElementDecls.entrySet()) {
            if(e.getKey()==null)
                throw new IllegalArgumentException("nulls in additionalElementDecls");
        }
    }
    return new JAXBModelImpl(r, builder.reader, rootClasses, new HashMap<QName, Reference>(additionalElementDecls));
}
项目:openjdk-jdk10    文件:JAXBModelImpl.java   
private NonElement<TypeMirror, TypeElement> getXmlType(Reference r) {
    if(r==null)
        throw new IllegalArgumentException();

    XmlJavaTypeAdapter xjta = r.annotations.getAnnotation(XmlJavaTypeAdapter.class);
    XmlList xl = r.annotations.getAnnotation(XmlList.class);

    Ref<TypeMirror, TypeElement> ref = new Ref<TypeMirror, TypeElement>(
        reader,types.getNavigator(),r.type,xjta,xl);

    return types.getTypeInfo(ref);
}
项目:openjdk-jdk10    文件:PropertyInfoImpl.java   
private XmlJavaTypeAdapter getApplicableAdapter(T type) {
    XmlJavaTypeAdapter jta = seed.readAnnotation(XmlJavaTypeAdapter.class);
    if(jta!=null && isApplicable(jta,type))
        return jta;

    // check the applicable adapters on the package
    XmlJavaTypeAdapters jtas = reader().getPackageAnnotation(XmlJavaTypeAdapters.class, parent.clazz, seed );
    if(jtas!=null) {
        for (XmlJavaTypeAdapter xjta : jtas.value()) {
            if(isApplicable(xjta,type))
                return xjta;
        }
    }
    jta = reader().getPackageAnnotation(XmlJavaTypeAdapter.class, parent.clazz, seed );
    if(isApplicable(jta,type))
        return jta;

    // then on the target class
    C refType = nav().asDecl(type);
    if(refType!=null) {
        jta = reader().getClassAnnotation(XmlJavaTypeAdapter.class, refType, seed );
        if(jta!=null && isApplicable(jta,type)) // the one on the type always apply.
            return jta;
    }

    return null;
}
项目:openjdk-jdk10    文件:Adapter.java   
public Adapter(
    XmlJavaTypeAdapter spec,
    AnnotationReader<TypeT,ClassDeclT,?,?> reader,
    Navigator<TypeT,ClassDeclT,?,?> nav) {

    this( nav.asDecl(reader.getClassValue(spec,"value")), nav );
}
项目:openjdk-jdk10    文件:Ref.java   
public Ref(AnnotationReader<T,C,?,?> reader,
           Navigator<T,C,?,?> nav,
           T type, XmlJavaTypeAdapter xjta, XmlList xl ) {
    Adapter<T,C> adapter=null;
    if(xjta!=null) {
        adapter = new Adapter<T,C>(xjta,reader,nav);
        type = adapter.defaultType;
    }

    this.type = type;
    this.adapter = adapter;
    this.valueList = xl!=null;
}
项目:openjdk-jdk10    文件:JAXBContextImpl.java   
private NonElement<Type,Class> getXmlType(RuntimeTypeInfoSet tis, TypeReference tr) {
    if(tr==null)
        throw new IllegalArgumentException();

    XmlJavaTypeAdapter xjta = tr.get(XmlJavaTypeAdapter.class);
    XmlList xl = tr.get(XmlList.class);

    Ref<Type,Class> ref = new Ref<Type,Class>(annotationReader, tis.getNavigator(), tr.type, xjta, xl );

    return tis.getTypeInfo(ref);
}
项目:powsybl-core    文件:SmallSignalSecurityIndex.java   
@XmlElement(name = "m")
@XmlJavaTypeAdapter(MatrixAdapter.class)
public double[][] getValues() {
    return values;
}
项目:sumo    文件:ObjectFactory.java   
/**
 * Create an instance of {@link JAXBElement }{@code <}{@link String }{@code >}}
 * 
 */
@XmlElementDecl(namespace = "", name = "ellipsoidName")
@XmlJavaTypeAdapter(CollapsedStringAdapter.class)
public JAXBElement<String> createEllipsoidName(String value) {
    return new JAXBElement<String>(_EllipsoidName_QNAME, String.class, null, value);
}
项目:sumo    文件:ObjectFactory.java   
/**
 * Create an instance of {@link JAXBElement }{@code <}{@link String }{@code >}}
 * 
 */
@XmlElementDecl(namespace = "", name = "time")
@XmlJavaTypeAdapter(CollapsedStringAdapter.class)
public JAXBElement<String> createTime(String value) {
    return new JAXBElement<String>(_Time_QNAME, String.class, null, value);
}
项目:sumo    文件:ObjectFactory.java   
/**
 * Create an instance of {@link JAXBElement }{@code <}{@link String }{@code >}}
 * 
 */
@XmlElementDecl(namespace = "", name = "productLastLineUtcTime")
@XmlJavaTypeAdapter(CollapsedStringAdapter.class)
public JAXBElement<String> createProductLastLineUtcTime(String value) {
    return new JAXBElement<String>(_ProductLastLineUtcTime_QNAME, String.class, null, value);
}
项目:sumo    文件:ObjectFactory.java   
/**
 * Create an instance of {@link JAXBElement }{@code <}{@link String }{@code >}}
 * 
 */
@XmlElementDecl(namespace = "", name = "ascendingNodeTime")
@XmlJavaTypeAdapter(CollapsedStringAdapter.class)
public JAXBElement<String> createAscendingNodeTime(String value) {
    return new JAXBElement<String>(_AscendingNodeTime_QNAME, String.class, null, value);
}
项目:sumo    文件:ObjectFactory.java   
/**
 * Create an instance of {@link JAXBElement }{@code <}{@link String }{@code >}}
 * 
 */
@XmlElementDecl(namespace = "", name = "attitudeSource")
@XmlJavaTypeAdapter(CollapsedStringAdapter.class)
public JAXBElement<String> createAttitudeSource(String value) {
    return new JAXBElement<String>(_AttitudeSource_QNAME, String.class, null, value);
}
项目:sumo    文件:ObjectFactory.java   
/**
 * Create an instance of {@link JAXBElement }{@code <}{@link String }{@code >}}
 * 
 */
@XmlElementDecl(namespace = "", name = "pgSource")
@XmlJavaTypeAdapter(CollapsedStringAdapter.class)
public JAXBElement<String> createPgSource(String value) {
    return new JAXBElement<String>(_PgSource_QNAME, String.class, null, value);
}
项目:sumo    文件:ObjectFactory.java   
/**
 * Create an instance of {@link JAXBElement }{@code <}{@link String }{@code >}}
 * 
 */
@XmlElementDecl(namespace = "", name = "firstLineSensingTime")
@XmlJavaTypeAdapter(CollapsedStringAdapter.class)
public JAXBElement<String> createFirstLineSensingTime(String value) {
    return new JAXBElement<String>(_FirstLineSensingTime_QNAME, String.class, null, value);
}
项目:sumo    文件:ObjectFactory.java   
/**
 * Create an instance of {@link JAXBElement }{@code <}{@link String }{@code >}}
 * 
 */
@XmlElementDecl(namespace = "", name = "fineDceAzimuthStopTime")
@XmlJavaTypeAdapter(CollapsedStringAdapter.class)
public JAXBElement<String> createFineDceAzimuthStopTime(String value) {
    return new JAXBElement<String>(_FineDceAzimuthStopTime_QNAME, String.class, null, value);
}
项目:sumo    文件:ObjectFactory.java   
/**
 * Create an instance of {@link JAXBElement }{@code <}{@link String }{@code >}}
 * 
 */
@XmlElementDecl(namespace = "", name = "stopTime")
@XmlJavaTypeAdapter(CollapsedStringAdapter.class)
public JAXBElement<String> createStopTime(String value) {
    return new JAXBElement<String>(_StopTime_QNAME, String.class, null, value);
}
项目:sumo    文件:ObjectFactory.java   
/**
 * Create an instance of {@link JAXBElement }{@code <}{@link String }{@code >}}
 * 
 */
@XmlElementDecl(namespace = "", name = "pixelValue")
@XmlJavaTypeAdapter(CollapsedStringAdapter.class)
public JAXBElement<String> createPixelValue(String value) {
    return new JAXBElement<String>(_PixelValue_QNAME, String.class, null, value);
}
项目:sumo    文件:ObjectFactory.java   
/**
 * Create an instance of {@link JAXBElement }{@code <}{@link String }{@code >}}
 * 
 */
@XmlElementDecl(namespace = "", name = "frame")
@XmlJavaTypeAdapter(CollapsedStringAdapter.class)
public JAXBElement<String> createFrame(String value) {
    return new JAXBElement<String>(_Frame_QNAME, String.class, null, value);
}
项目:sumo    文件:ObjectFactory.java   
/**
 * Create an instance of {@link JAXBElement }{@code <}{@link String }{@code >}}
 * 
 */
@XmlElementDecl(namespace = "", name = "applicationLutId")
@XmlJavaTypeAdapter(CollapsedStringAdapter.class)
public JAXBElement<String> createApplicationLutId(String value) {
    return new JAXBElement<String>(_ApplicationLutId_QNAME, String.class, null, value);
}
项目:sumo    文件:ObjectFactory.java   
/**
 * Create an instance of {@link JAXBElement }{@code <}{@link String }{@code >}}
 * 
 */
@XmlElementDecl(namespace = "", name = "lastLineSensingTime")
@XmlJavaTypeAdapter(CollapsedStringAdapter.class)
public JAXBElement<String> createLastLineSensingTime(String value) {
    return new JAXBElement<String>(_LastLineSensingTime_QNAME, String.class, null, value);
}
项目:sumo    文件:ObjectFactory.java   
/**
 * Create an instance of {@link JAXBElement }{@code <}{@link String }{@code >}}
 * 
 */
@XmlElementDecl(namespace = "", name = "fineDceAzimuthStartTime")
@XmlJavaTypeAdapter(CollapsedStringAdapter.class)
public JAXBElement<String> createFineDceAzimuthStartTime(String value) {
    return new JAXBElement<String>(_FineDceAzimuthStartTime_QNAME, String.class, null, value);
}
项目:sumo    文件:ObjectFactory.java   
/**
 * Create an instance of {@link JAXBElement }{@code <}{@link String }{@code >}}
 * 
 */
@XmlElementDecl(namespace = "", name = "azimuthTime")
@XmlJavaTypeAdapter(CollapsedStringAdapter.class)
public JAXBElement<String> createAzimuthTime(String value) {
    return new JAXBElement<String>(_AzimuthTime_QNAME, String.class, null, value);
}
项目:sumo    文件:ObjectFactory.java   
/**
 * Create an instance of {@link JAXBElement }{@code <}{@link String }{@code >}}
 * 
 */
@XmlElementDecl(namespace = "", name = "polarisation")
@XmlJavaTypeAdapter(CollapsedStringAdapter.class)
public JAXBElement<String> createPolarisation(String value) {
    return new JAXBElement<String>(_Polarisation_QNAME, String.class, null, value);
}
项目:sumo    文件:ObjectFactory.java   
/**
 * Create an instance of {@link JAXBElement }{@code <}{@link String }{@code >}}
 * 
 */
@XmlElementDecl(namespace = "", name = "productType")
@XmlJavaTypeAdapter(CollapsedStringAdapter.class)
public JAXBElement<String> createProductType(String value) {
    return new JAXBElement<String>(_ProductType_QNAME, String.class, null, value);
}
项目:sumo    文件:ObjectFactory.java   
/**
 * Create an instance of {@link JAXBElement }{@code <}{@link String }{@code >}}
 * 
 */
@XmlElementDecl(namespace = "", name = "startTime")
@XmlJavaTypeAdapter(CollapsedStringAdapter.class)
public JAXBElement<String> createStartTime(String value) {
    return new JAXBElement<String>(_StartTime_QNAME, String.class, null, value);
}
项目:sumo    文件:ObjectFactory.java   
/**
 * Create an instance of {@link JAXBElement }{@code <}{@link String }{@code >}}
 * 
 */
@XmlElementDecl(namespace = "", name = "pgSourceUsed")
@XmlJavaTypeAdapter(CollapsedStringAdapter.class)
public JAXBElement<String> createPgSourceUsed(String value) {
    return new JAXBElement<String>(_PgSourceUsed_QNAME, String.class, null, value);
}
项目:sumo    文件:ObjectFactory.java   
/**
 * Create an instance of {@link JAXBElement }{@code <}{@link String }{@code >}}
 * 
 */
@XmlElementDecl(namespace = "", name = "swath")
@XmlJavaTypeAdapter(CollapsedStringAdapter.class)
public JAXBElement<String> createSwath(String value) {
    return new JAXBElement<String>(_Swath_QNAME, String.class, null, value);
}
项目:sumo    文件:ObjectFactory.java   
/**
 * Create an instance of {@link JAXBElement }{@code <}{@link String }{@code >}}
 * 
 */
@XmlElementDecl(namespace = "", name = "timelinessCategory")
@XmlJavaTypeAdapter(CollapsedStringAdapter.class)
public JAXBElement<String> createTimelinessCategory(String value) {
    return new JAXBElement<String>(_TimelinessCategory_QNAME, String.class, null, value);
}
项目:sumo    文件:ObjectFactory.java   
/**
 * Create an instance of {@link JAXBElement }{@code <}{@link String }{@code >}}
 * 
 */
@XmlElementDecl(namespace = "", name = "mode")
@XmlJavaTypeAdapter(CollapsedStringAdapter.class)
public JAXBElement<String> createMode(String value) {
    return new JAXBElement<String>(_Mode_QNAME, String.class, null, value);
}
项目:sumo    文件:ObjectFactory.java   
/**
 * Create an instance of {@link JAXBElement }{@code <}{@link String }{@code >}}
 * 
 */
@XmlElementDecl(namespace = "", name = "orbitSource")
@XmlJavaTypeAdapter(CollapsedStringAdapter.class)
public JAXBElement<String> createOrbitSource(String value) {
    return new JAXBElement<String>(_OrbitSource_QNAME, String.class, null, value);
}
项目:sumo    文件:ObjectFactory.java   
/**
 * Create an instance of {@link JAXBElement }{@code <}{@link String }{@code >}}
 * 
 */
@XmlElementDecl(namespace = "", name = "calibrationFormat")
@XmlJavaTypeAdapter(CollapsedStringAdapter.class)
public JAXBElement<String> createCalibrationFormat(String value) {
    return new JAXBElement<String>(_CalibrationFormat_QNAME, String.class, null, value);
}