javax.xml.bind.annotation.XmlEnum#com.sun.xml.internal.bind.v2.model.annotation.Locatable源码实例Demo

下面列出了javax.xml.bind.annotation.XmlEnum#com.sun.xml.internal.bind.v2.model.annotation.Locatable 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: openjdk-jdk8u   文件: ModelBuilder.java
/**
 * Have the builder recognize the type (if it hasn't done so yet),
 * and returns a {@link NonElement} that represents it.
 *
 * @return
 *      always non-null.
 */
public NonElement<T,C> getTypeInfo(T t,Locatable upstream) {
    NonElement<T,C> r = typeInfoSet.getTypeInfo(t);
    if(r!=null)     return r;

    if(nav.isArray(t)) { // no need for checking byte[], because above typeInfoset.getTypeInfo() would return non-null
        ArrayInfoImpl<T,C,F,M> ai =
            createArrayInfo(upstream, t);
        addTypeName(ai);
        typeInfoSet.add(ai);
        return ai;
    }

    C c = nav.asDecl(t);
    assert c!=null : t.toString()+" must be a leaf, but we failed to recognize it.";
    return getClassInfo(c,upstream);
}
 
源代码2 项目: openjdk-jdk8u-backup   文件: ModelBuilder.java
/**
 * Have the builder recognize the type (if it hasn't done so yet),
 * and returns a {@link NonElement} that represents it.
 *
 * @return
 *      always non-null.
 */
public NonElement<T,C> getTypeInfo(T t,Locatable upstream) {
    NonElement<T,C> r = typeInfoSet.getTypeInfo(t);
    if(r!=null)     return r;

    if(nav.isArray(t)) { // no need for checking byte[], because above typeInfoset.getTypeInfo() would return non-null
        ArrayInfoImpl<T,C,F,M> ai =
            createArrayInfo(upstream, t);
        addTypeName(ai);
        typeInfoSet.add(ai);
        return ai;
    }

    C c = nav.asDecl(t);
    assert c!=null : t.toString()+" must be a leaf, but we failed to recognize it.";
    return getClassInfo(c,upstream);
}
 
源代码3 项目: openjdk-jdk9   文件: ModelBuilder.java
/**
 * Have the builder recognize the type (if it hasn't done so yet),
 * and returns a {@link NonElement} that represents it.
 *
 * @return
 *      always non-null.
 */
public NonElement<T,C> getTypeInfo(T t,Locatable upstream) {
    NonElement<T,C> r = typeInfoSet.getTypeInfo(t);
    if(r!=null)     return r;

    if(nav.isArray(t)) { // no need for checking byte[], because above typeInfoset.getTypeInfo() would return non-null
        ArrayInfoImpl<T,C,F,M> ai =
            createArrayInfo(upstream, t);
        addTypeName(ai);
        typeInfoSet.add(ai);
        return ai;
    }

    C c = nav.asDecl(t);
    assert c!=null : t.toString()+" must be a leaf, but we failed to recognize it.";
    return getClassInfo(c,upstream);
}
 
源代码4 项目: openjdk-8   文件: ModelBuilder.java
/**
 * Have the builder recognize the type (if it hasn't done so yet),
 * and returns a {@link NonElement} that represents it.
 *
 * @return
 *      always non-null.
 */
public NonElement<T,C> getTypeInfo(T t,Locatable upstream) {
    NonElement<T,C> r = typeInfoSet.getTypeInfo(t);
    if(r!=null)     return r;

    if(nav.isArray(t)) { // no need for checking byte[], because above typeInfoset.getTypeInfo() would return non-null
        ArrayInfoImpl<T,C,F,M> ai =
            createArrayInfo(upstream, t);
        addTypeName(ai);
        typeInfoSet.add(ai);
        return ai;
    }

    C c = nav.asDecl(t);
    assert c!=null : t.toString()+" must be a leaf, but we failed to recognize it.";
    return getClassInfo(c,upstream);
}
 
源代码5 项目: openjdk-jdk8u   文件: EnumLeafInfoImpl.java
/**
 * @param clazz
 * @param type
 *      clazz and type should both point to the enum class
 *      that this {@link EnumLeafInfo} represents.
 *      Because of the type parameterization we have to take them separately.
 */
public EnumLeafInfoImpl(ModelBuilder<T,C,F,M> builder,
                        Locatable upstream, C clazz, T type ) {
    super(builder,upstream);
    this.clazz = clazz;
    this.type = type;

    elementName = parseElementName(clazz);

    // compute the type name
    // TODO: I guess it must be allowed for enums to have @XmlElement
    typeName = parseTypeName(clazz);

    // locate the base type.
    // this can be done eagerly because there shouldn't be no cycle.
    XmlEnum xe = builder.reader.getClassAnnotation(XmlEnum.class, clazz, this);
    if(xe!=null) {
        T base = builder.reader.getClassValue(xe, "value");
        baseType = builder.getTypeInfo(base,this);
    } else {
        baseType = builder.getTypeInfo(builder.nav.ref(String.class),this);
    }
}
 
源代码6 项目: hottub   文件: EnumLeafInfoImpl.java
/**
 * @param clazz
 * @param type
 *      clazz and type should both point to the enum class
 *      that this {@link EnumLeafInfo} represents.
 *      Because of the type parameterization we have to take them separately.
 */
public EnumLeafInfoImpl(ModelBuilder<T,C,F,M> builder,
                        Locatable upstream, C clazz, T type ) {
    super(builder,upstream);
    this.clazz = clazz;
    this.type = type;

    elementName = parseElementName(clazz);

    // compute the type name
    // TODO: I guess it must be allowed for enums to have @XmlElement
    typeName = parseTypeName(clazz);

    // locate the base type.
    // this can be done eagerly because there shouldn't be no cycle.
    XmlEnum xe = builder.reader.getClassAnnotation(XmlEnum.class, clazz, this);
    if(xe!=null) {
        T base = builder.reader.getClassValue(xe, "value");
        baseType = builder.getTypeInfo(base,this);
    } else {
        baseType = builder.getTypeInfo(builder.nav.ref(String.class),this);
    }
}
 
源代码7 项目: openjdk-8   文件: IllegalAnnotationException.java
private List<List<Location>> build(Locatable... srcs) {
    List<List<Location>> r = new ArrayList<List<Location>>();
    for( Locatable l : srcs ) {
        if(l!=null) {
            List<Location> ll = convert(l);
            if(ll!=null && !ll.isEmpty())
                r.add(ll);
        }
    }
    return Collections.unmodifiableList(r);
}
 
源代码8 项目: TencentKona-8   文件: Util.java
static <T,C,F,M> QName calcSchemaType(
        AnnotationReader<T,C,F,M> reader,
        AnnotationSource primarySource, C enclosingClass, T individualType, Locatable src ) {

    XmlSchemaType xst = primarySource.readAnnotation(XmlSchemaType.class);
    if(xst!=null) {
        return new QName(xst.namespace(),xst.name());
    }

    // check the defaulted annotation
    XmlSchemaTypes xsts = reader.getPackageAnnotation(XmlSchemaTypes.class,enclosingClass,src);
    XmlSchemaType[] values = null;
    if(xsts!=null)
        values = xsts.value();
    else {
        xst = reader.getPackageAnnotation(XmlSchemaType.class,enclosingClass,src);
        if(xst!=null) {
            values = new XmlSchemaType[1];
            values[0] = xst;
        }
    }
    if(values!=null) {
        for( XmlSchemaType item : values ) {
            if(reader.getClassValue(item,"type").equals(individualType)) {
                return new QName(item.namespace(),item.name());
            }
        }
    }

    return null;
}
 
源代码9 项目: hottub   文件: Util.java
static <T,C,F,M> QName calcSchemaType(
        AnnotationReader<T,C,F,M> reader,
        AnnotationSource primarySource, C enclosingClass, T individualType, Locatable src ) {

    XmlSchemaType xst = primarySource.readAnnotation(XmlSchemaType.class);
    if(xst!=null) {
        return new QName(xst.namespace(),xst.name());
    }

    // check the defaulted annotation
    XmlSchemaTypes xsts = reader.getPackageAnnotation(XmlSchemaTypes.class,enclosingClass,src);
    XmlSchemaType[] values = null;
    if(xsts!=null)
        values = xsts.value();
    else {
        xst = reader.getPackageAnnotation(XmlSchemaType.class,enclosingClass,src);
        if(xst!=null) {
            values = new XmlSchemaType[1];
            values[0] = xst;
        }
    }
    if(values!=null) {
        for( XmlSchemaType item : values ) {
            if(reader.getClassValue(item,"type").equals(individualType)) {
                return new QName(item.namespace(),item.name());
            }
        }
    }

    return null;
}
 
private List<List<Location>> build(Locatable... srcs) {
    List<List<Location>> r = new ArrayList<List<Location>>();
    for( Locatable l : srcs ) {
        if(l!=null) {
            List<Location> ll = convert(l);
            if(ll!=null && !ll.isEmpty())
                r.add(ll);
        }
    }
    return Collections.unmodifiableList(r);
}
 
源代码11 项目: openjdk-jdk8u   文件: IllegalAnnotationException.java
private List<List<Location>> build(Locatable... srcs) {
    List<List<Location>> r = new ArrayList<List<Location>>();
    for( Locatable l : srcs ) {
        if(l!=null) {
            List<Location> ll = convert(l);
            if(ll!=null && !ll.isEmpty())
                r.add(ll);
        }
    }
    return Collections.unmodifiableList(r);
}
 
源代码12 项目: openjdk-jdk8u   文件: TypeInfoImpl.java
protected TypeInfoImpl(
    ModelBuilder<TypeT,ClassDeclT,FieldT,MethodT> builder,
    Locatable upstream) {

    this.builder = builder;
    this.owner = builder.typeInfoSet;
    this.upstream = upstream;
}
 
源代码13 项目: openjdk-8   文件: Util.java
static <T,C,F,M> QName calcSchemaType(
        AnnotationReader<T,C,F,M> reader,
        AnnotationSource primarySource, C enclosingClass, T individualType, Locatable src ) {

    XmlSchemaType xst = primarySource.readAnnotation(XmlSchemaType.class);
    if(xst!=null) {
        return new QName(xst.namespace(),xst.name());
    }

    // check the defaulted annotation
    XmlSchemaTypes xsts = reader.getPackageAnnotation(XmlSchemaTypes.class,enclosingClass,src);
    XmlSchemaType[] values = null;
    if(xsts!=null)
        values = xsts.value();
    else {
        xst = reader.getPackageAnnotation(XmlSchemaType.class,enclosingClass,src);
        if(xst!=null) {
            values = new XmlSchemaType[1];
            values[0] = xst;
        }
    }
    if(values!=null) {
        for( XmlSchemaType item : values ) {
            if(reader.getClassValue(item,"type").equals(individualType)) {
                return new QName(item.namespace(),item.name());
            }
        }
    }

    return null;
}
 
源代码14 项目: jdk8u60   文件: IllegalAnnotationException.java
private List<List<Location>> build(Locatable... srcs) {
    List<List<Location>> r = new ArrayList<List<Location>>();
    for( Locatable l : srcs ) {
        if(l!=null) {
            List<Location> ll = convert(l);
            if(ll!=null && !ll.isEmpty())
                r.add(ll);
        }
    }
    return Collections.unmodifiableList(r);
}
 
源代码15 项目: jdk8u60   文件: Util.java
static <T,C,F,M> QName calcSchemaType(
        AnnotationReader<T,C,F,M> reader,
        AnnotationSource primarySource, C enclosingClass, T individualType, Locatable src ) {

    XmlSchemaType xst = primarySource.readAnnotation(XmlSchemaType.class);
    if(xst!=null) {
        return new QName(xst.namespace(),xst.name());
    }

    // check the defaulted annotation
    XmlSchemaTypes xsts = reader.getPackageAnnotation(XmlSchemaTypes.class,enclosingClass,src);
    XmlSchemaType[] values = null;
    if(xsts!=null)
        values = xsts.value();
    else {
        xst = reader.getPackageAnnotation(XmlSchemaType.class,enclosingClass,src);
        if(xst!=null) {
            values = new XmlSchemaType[1];
            values[0] = xst;
        }
    }
    if(values!=null) {
        for( XmlSchemaType item : values ) {
            if(reader.getClassValue(item,"type").equals(individualType)) {
                return new QName(item.namespace(),item.name());
            }
        }
    }

    return null;
}
 
源代码16 项目: openjdk-jdk9   文件: TypeInfoImpl.java
protected TypeInfoImpl(
    ModelBuilder<TypeT,ClassDeclT,FieldT,MethodT> builder,
    Locatable upstream) {

    this.builder = builder;
    this.owner = builder.typeInfoSet;
    this.upstream = upstream;
}
 
源代码17 项目: openjdk-8-source   文件: AnyTypeImpl.java
public Locatable getUpstream() {
    return null;
}
 
源代码18 项目: hottub   文件: RuntimeModelBuilder.java
@Override
public RuntimeNonElement getClassInfo( Class clazz, Locatable upstream ) {
    return (RuntimeNonElement)super.getClassInfo(clazz,upstream);
}
 
源代码19 项目: openjdk-jdk9   文件: IllegalAnnotationException.java
public IllegalAnnotationException(String message, Annotation src1, Locatable src2) {
    this(message,cast(src1),src2);
}
 
源代码20 项目: openjdk-jdk8u   文件: AbstractCTypeInfoImpl.java
public final Locatable getUpstream() {
    throw new UnsupportedOperationException();
}
 
源代码21 项目: openjdk-jdk8u-backup   文件: CBuiltinLeafInfo.java
public Locatable getUpstream() {
    return null;
}
 
源代码22 项目: openjdk-jdk8u   文件: AnyTypeImpl.java
public Locatable getUpstream() {
    return null;
}
 
源代码23 项目: openjdk-jdk9   文件: RuntimeModelBuilder.java
@Override
public RuntimeNonElement getClassInfo( Class clazz, Locatable upstream ) {
    return (RuntimeNonElement)super.getClassInfo(clazz,upstream);
}
 
源代码24 项目: openjdk-jdk8u   文件: FieldPropertySeed.java
/**
 * Use the enclosing class as the upsream {@link Location}.
 */
public Locatable getUpstream() {
    return parent;
}
 
源代码25 项目: openjdk-jdk9   文件: IllegalAnnotationException.java
public IllegalAnnotationException(String message, Locatable src1, Locatable src2) {
    super(message);
    pos = build(src1,src2);
}
 
源代码26 项目: openjdk-jdk8u-backup   文件: RegistryInfoImpl.java
/**
 * Picks up references in this registry to other types.
 */
RegistryInfoImpl(ModelBuilder<T,C,F,M> builder, Locatable upstream, C registryClass) {
    this.nav = builder.nav;
    this.registryClass = registryClass;
    this.upstream = upstream;
    builder.registries.put(getPackageName(),this);

    if(nav.getDeclaredField(registryClass,ContextFactory.USE_JAXB_PROPERTIES)!=null) {
        // the user is trying to use ObjectFactory that we generate for interfaces,
        // that means he's missing jaxb.properties
        builder.reportError(new IllegalAnnotationException(
            Messages.MISSING_JAXB_PROPERTIES.format(getPackageName()),
            this
        ));
        // looking at members will only add more errors, so just abort now
        return;
    }

    for( M m : nav.getDeclaredMethods(registryClass) ) {
        XmlElementDecl em = builder.reader.getMethodAnnotation(
            XmlElementDecl.class, m, this );

        if(em==null) {
            if(nav.getMethodName(m).startsWith("create")) {
                // this is a factory method. visit this class
                references.add(
                    builder.getTypeInfo(nav.getReturnType(m),
                        new MethodLocatable<M>(this,m,nav)));
            }

            continue;
        }

        ElementInfoImpl<T,C,F,M> ei;
        try {
            ei = builder.createElementInfo(this,m);
        } catch (IllegalAnnotationException e) {
            builder.reportError(e);
            continue;   // recover by ignoring this element
        }

        // register this mapping
        // TODO: any chance this could cause a stack overflow (by recursively visiting classes)?
        builder.typeInfoSet.add(ei,builder);
        references.add(ei);
    }
}
 
源代码27 项目: hottub   文件: ModelBuilder.java
protected EnumLeafInfoImpl<T,C,F,M> createEnumLeafInfo(C clazz,Locatable upstream) {
    return new EnumLeafInfoImpl<T,C,F,M>(this,upstream,clazz,nav.use(clazz));
}
 
源代码28 项目: TencentKona-8   文件: ModelBuilder.java
/**
 * For limited cases where the caller needs to search for a super class.
 * This is necessary because we don't want {@link #subclassReplacements}
 * to kick in for the super class search, which will cause infinite recursion.
 */
public NonElement<T,C> getClassInfo( C clazz, boolean searchForSuperClass, Locatable upstream ) {
    assert clazz!=null;
    NonElement<T,C> r = typeInfoSet.getClassInfo(clazz);
    if(r!=null)
        return r;

    if(nav.isEnum(clazz)) {
        EnumLeafInfoImpl<T,C,F,M> li = createEnumLeafInfo(clazz,upstream);
        typeInfoSet.add(li);
        r = li;
        addTypeName(r);
    } else {
        boolean isReplaced = subclassReplacements.containsKey(clazz);
        if(isReplaced && !searchForSuperClass) {
            // handle it as if the replacement was specified
            r = getClassInfo(subclassReplacements.get(clazz),upstream);
        } else
        if(reader.hasClassAnnotation(clazz,XmlTransient.class) || isReplaced) {
            // handle it as if the base class was specified
            r = getClassInfo( nav.getSuperClass(clazz), searchForSuperClass,
                    new ClassLocatable<C>(upstream,clazz,nav) );
        } else {
            ClassInfoImpl<T,C,F,M> ci = createClassInfo(clazz,upstream);
            typeInfoSet.add(ci);

            // compute the closure by eagerly expanding references
            for( PropertyInfo<T,C> p : ci.getProperties() ) {
                if(p.kind()== PropertyKind.REFERENCE) {
                    // make sure that we have a registry for this package
                    addToRegistry(clazz, (Locatable) p);
                    Class[] prmzdClasses = getParametrizedTypes(p);
                    if (prmzdClasses != null) {
                        for (Class prmzdClass : prmzdClasses) {
                            if (prmzdClass != clazz) {
                                addToRegistry((C) prmzdClass, (Locatable) p);
                            }
                        }
                    }
                }

                for( TypeInfo<T,C> t : p.ref() )
                    ; // just compute a reference should be suffice
            }
            ci.getBaseClass(); // same as above.

            r = ci;
            addTypeName(r);
        }
    }


    // more reference closure expansion. @XmlSeeAlso
    XmlSeeAlso sa = reader.getClassAnnotation(XmlSeeAlso.class, clazz, upstream);
    if(sa!=null) {
        for( T t : reader.getClassArrayValue(sa,"value") ) {
            getTypeInfo(t,(Locatable)sa);
        }
    }


    return r;
}
 
源代码29 项目: openjdk-jdk8u-backup   文件: AnyTypeImpl.java
public Locatable getUpstream() {
    return null;
}
 
源代码30 项目: openjdk-8-source   文件: CBuiltinLeafInfo.java
public Locatable getUpstream() {
    return null;
}