當前位置: 首頁>>代碼示例>>Java>>正文


Java XmlJavaTypeAdapter類代碼示例

本文整理匯總了Java中javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter的典型用法代碼示例。如果您正苦於以下問題:Java XmlJavaTypeAdapter類的具體用法?Java XmlJavaTypeAdapter怎麽用?Java XmlJavaTypeAdapter使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


XmlJavaTypeAdapter類屬於javax.xml.bind.annotation.adapters包,在下文中一共展示了XmlJavaTypeAdapter類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: isApplicable

import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; //導入依賴的package包/類
/**
 * 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);
}
 
開發者ID:SunburstApps,項目名稱:OpenJSharp,代碼行數:19,代碼來源:PropertyInfoImpl.java

示例2: createAssertionIDRef

import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; //導入依賴的package包/類
/**
 * 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);
}
 
開發者ID:servicecatalog,項目名稱:oscm,代碼行數:11,代碼來源:ObjectFactory.java

示例3: getApplicableAdapter

import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; //導入依賴的package包/類
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;
}
 
開發者ID:SunburstApps,項目名稱:OpenJSharp,代碼行數:28,代碼來源:PropertyInfoImpl.java

示例4: Adapter

import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; //導入依賴的package包/類
public Adapter(
    XmlJavaTypeAdapter spec,
    AnnotationReader<TypeT,ClassDeclT,?,?> reader,
    Navigator<TypeT,ClassDeclT,?,?> nav) {

    this( nav.asDecl(reader.getClassValue(spec,"value")), nav );
}
 
開發者ID:SunburstApps,項目名稱:OpenJSharp,代碼行數:8,代碼來源:Adapter.java

示例5: Ref

import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; //導入依賴的package包/類
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;
}
 
開發者ID:SunburstApps,項目名稱:OpenJSharp,代碼行數:14,代碼來源:Ref.java

示例6: getXmlType

import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; //導入依賴的package包/類
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);
}
 
開發者ID:SunburstApps,項目名稱:OpenJSharp,代碼行數:12,代碼來源:JAXBContextImpl.java

示例7: bind

import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; //導入依賴的package包/類
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));
}
 
開發者ID:SunburstApps,項目名稱:OpenJSharp,代碼行數:39,代碼來源:JavaCompilerImpl.java

示例8: getXmlType

import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; //導入依賴的package包/類
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);
}
 
開發者ID:SunburstApps,項目名稱:OpenJSharp,代碼行數:13,代碼來源:JAXBModelImpl.java

示例9: getValues

import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; //導入依賴的package包/類
@XmlElement(name = "m")
@XmlJavaTypeAdapter(MatrixAdapter.class)
public double[][] getValues() {
    return values;
}
 
開發者ID:powsybl,項目名稱:powsybl-core,代碼行數:6,代碼來源:SmallSignalSecurityIndex.java

示例10: createEllipsoidName

import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; //導入依賴的package包/類
/**
 * 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);
}
 
開發者ID:ec-europa,項目名稱:sumo,代碼行數:10,代碼來源:ObjectFactory.java

示例11: createTime

import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; //導入依賴的package包/類
/**
 * 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);
}
 
開發者ID:ec-europa,項目名稱:sumo,代碼行數:10,代碼來源:ObjectFactory.java

示例12: createProductLastLineUtcTime

import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; //導入依賴的package包/類
/**
 * 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);
}
 
開發者ID:ec-europa,項目名稱:sumo,代碼行數:10,代碼來源:ObjectFactory.java

示例13: createAscendingNodeTime

import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; //導入依賴的package包/類
/**
 * 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);
}
 
開發者ID:ec-europa,項目名稱:sumo,代碼行數:10,代碼來源:ObjectFactory.java

示例14: createAttitudeSource

import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; //導入依賴的package包/類
/**
 * 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);
}
 
開發者ID:ec-europa,項目名稱:sumo,代碼行數:10,代碼來源:ObjectFactory.java

示例15: createPgSource

import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; //導入依賴的package包/類
/**
 * 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);
}
 
開發者ID:ec-europa,項目名稱:sumo,代碼行數:10,代碼來源:ObjectFactory.java


注:本文中的javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。