com.sun.tools.internal.xjc.model.nav.NType Java Examples

The following examples show how to use com.sun.tools.internal.xjc.model.nav.NType. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: TypeAndAnnotationImpl.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
public JType getTypeClass() {
    CAdapter a = typeUse.getAdapterUse();
    NType nt;
    if(a!=null)
        nt = a.customType;
    else
        nt = typeUse.getInfo().getType();

    JType jt = nt.toType(outline,EXPOSED);

    JPrimitiveType prim = jt.boxify().getPrimitiveType();
    if(!typeUse.isCollection() && prim!=null)
        jt = prim;

    if(typeUse.isCollection())
        jt = jt.array();

    return jt;
}
 
Example #2
Source File: TypeAndAnnotationImpl.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
public JType getTypeClass() {
    CAdapter a = typeUse.getAdapterUse();
    NType nt;
    if(a!=null)
        nt = a.customType;
    else
        nt = typeUse.getInfo().getType();

    JType jt = nt.toType(outline,EXPOSED);

    JPrimitiveType prim = jt.boxify().getPrimitiveType();
    if(!typeUse.isCollection() && prim!=null)
        jt = prim;

    if(typeUse.isCollection())
        jt = jt.array();

    return jt;
}
 
Example #3
Source File: TypeAndAnnotationImpl.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
public JType getTypeClass() {
    CAdapter a = typeUse.getAdapterUse();
    NType nt;
    if(a!=null)
        nt = a.customType;
    else
        nt = typeUse.getInfo().getType();

    JType jt = nt.toType(outline,EXPOSED);

    JPrimitiveType prim = jt.boxify().getPrimitiveType();
    if(!typeUse.isCollection() && prim!=null)
        jt = prim;

    if(typeUse.isCollection())
        jt = jt.array();

    return jt;
}
 
Example #4
Source File: RawTypeSet.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Returns true if {@link #refs} can form refs of types.
 *
 * If there are multiple {@link Ref}s with the same type,
 * we cannot make them into type refs. Or if any of the {@link Ref}
 * says they cannot be in type refs, we cannot do that either.
 *
 * TODO: just checking if the refs are the same is not suffice.
 * If two refs derive from each other, they cannot form a list of refs
 * (because of a possible ambiguity).
 */
private Mode canBeTypeRefs() {
    Set<NType> types = new HashSet<NType>();

    collectionMode = mul.isAtMostOnce()?NOT_REPEATED:REPEATED_ELEMENT;

    // the way we compute this is that we start from the most optimistic value,
    // and then gradually degrade as we find something problematic.
    Mode mode = Mode.SHOULD_BE_TYPEREF;

    for( Ref r : refs ) {
        mode = mode.or(r.canBeType(this));
        if(mode== Mode.MUST_BE_REFERENCE)
            return mode;    // no need to continue the processing

        if(!types.add(r.toTypeRef(null).getTarget().getType()))
            return Mode.MUST_BE_REFERENCE;   // collision
        if(r.isListOfValues()) {
            if(refs.size()>1 || !mul.isAtMostOnce())
                return Mode.MUST_BE_REFERENCE;   // restriction on @XmlList
            collectionMode = REPEATED_VALUE;
        }
    }
    return mode;
}
 
Example #5
Source File: RawTypeSet.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Returns true if {@link #refs} can form refs of types.
 *
 * If there are multiple {@link Ref}s with the same type,
 * we cannot make them into type refs. Or if any of the {@link Ref}
 * says they cannot be in type refs, we cannot do that either.
 *
 * TODO: just checking if the refs are the same is not suffice.
 * If two refs derive from each other, they cannot form a list of refs
 * (because of a possible ambiguity).
 */
private Mode canBeTypeRefs() {
    Set<NType> types = new HashSet<NType>();

    collectionMode = mul.isAtMostOnce()?NOT_REPEATED:REPEATED_ELEMENT;

    // the way we compute this is that we start from the most optimistic value,
    // and then gradually degrade as we find something problematic.
    Mode mode = Mode.SHOULD_BE_TYPEREF;

    for( Ref r : refs ) {
        mode = mode.or(r.canBeType(this));
        if(mode== Mode.MUST_BE_REFERENCE)
            return mode;    // no need to continue the processing

        if(!types.add(r.toTypeRef(null).getTarget().getType()))
            return Mode.MUST_BE_REFERENCE;   // collision
        if(r.isListOfValues()) {
            if(refs.size()>1 || !mul.isAtMostOnce())
                return Mode.MUST_BE_REFERENCE;   // restriction on @XmlList
            collectionMode = REPEATED_VALUE;
        }
    }
    return mode;
}
 
Example #6
Source File: RawTypeSet.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Returns true if {@link #refs} can form refs of types.
 *
 * If there are multiple {@link Ref}s with the same type,
 * we cannot make them into type refs. Or if any of the {@link Ref}
 * says they cannot be in type refs, we cannot do that either.
 *
 * TODO: just checking if the refs are the same is not suffice.
 * If two refs derive from each other, they cannot form a list of refs
 * (because of a possible ambiguity).
 */
private Mode canBeTypeRefs() {
    Set<NType> types = new HashSet<NType>();

    collectionMode = mul.isAtMostOnce()?NOT_REPEATED:REPEATED_ELEMENT;

    // the way we compute this is that we start from the most optimistic value,
    // and then gradually degrade as we find something problematic.
    Mode mode = Mode.SHOULD_BE_TYPEREF;

    for( Ref r : refs ) {
        mode = mode.or(r.canBeType(this));
        if(mode== Mode.MUST_BE_REFERENCE)
            return mode;    // no need to continue the processing

        if(!types.add(r.toTypeRef(null).getTarget().getType()))
            return Mode.MUST_BE_REFERENCE;   // collision
        if(r.isListOfValues()) {
            if(refs.size()>1 || !mul.isAtMostOnce())
                return Mode.MUST_BE_REFERENCE;   // restriction on @XmlList
            collectionMode = REPEATED_VALUE;
        }
    }
    return mode;
}
 
Example #7
Source File: RawTypeSet.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Returns true if {@link #refs} can form refs of types.
 *
 * If there are multiple {@link Ref}s with the same type,
 * we cannot make them into type refs. Or if any of the {@link Ref}
 * says they cannot be in type refs, we cannot do that either.
 *
 * TODO: just checking if the refs are the same is not suffice.
 * If two refs derive from each other, they cannot form a list of refs
 * (because of a possible ambiguity).
 */
private Mode canBeTypeRefs() {
    Set<NType> types = new HashSet<NType>();

    collectionMode = mul.isAtMostOnce()?NOT_REPEATED:REPEATED_ELEMENT;

    // the way we compute this is that we start from the most optimistic value,
    // and then gradually degrade as we find something problematic.
    Mode mode = Mode.SHOULD_BE_TYPEREF;

    for( Ref r : refs ) {
        mode = mode.or(r.canBeType(this));
        if(mode== Mode.MUST_BE_REFERENCE)
            return mode;    // no need to continue the processing

        if(!types.add(r.toTypeRef(null).getTarget().getType()))
            return Mode.MUST_BE_REFERENCE;   // collision
        if(r.isListOfValues()) {
            if(refs.size()>1 || !mul.isAtMostOnce())
                return Mode.MUST_BE_REFERENCE;   // restriction on @XmlList
            collectionMode = REPEATED_VALUE;
        }
    }
    return mode;
}
 
Example #8
Source File: RawTypeSet.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Returns true if {@link #refs} can form refs of types.
 *
 * If there are multiple {@link Ref}s with the same type,
 * we cannot make them into type refs. Or if any of the {@link Ref}
 * says they cannot be in type refs, we cannot do that either.
 *
 * TODO: just checking if the refs are the same is not suffice.
 * If two refs derive from each other, they cannot form a list of refs
 * (because of a possible ambiguity).
 */
private Mode canBeTypeRefs() {
    Set<NType> types = new HashSet<NType>();

    collectionMode = mul.isAtMostOnce()?NOT_REPEATED:REPEATED_ELEMENT;

    // the way we compute this is that we start from the most optimistic value,
    // and then gradually degrade as we find something problematic.
    Mode mode = Mode.SHOULD_BE_TYPEREF;

    for( Ref r : refs ) {
        mode = mode.or(r.canBeType(this));
        if(mode== Mode.MUST_BE_REFERENCE)
            return mode;    // no need to continue the processing

        if(!types.add(r.toTypeRef(null).getTarget().getType()))
            return Mode.MUST_BE_REFERENCE;   // collision
        if(r.isListOfValues()) {
            if(refs.size()>1 || !mul.isAtMostOnce())
                return Mode.MUST_BE_REFERENCE;   // restriction on @XmlList
            collectionMode = REPEATED_VALUE;
        }
    }
    return mode;
}
 
Example #9
Source File: RawTypeSet.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Returns true if {@link #refs} can form refs of types.
 *
 * If there are multiple {@link Ref}s with the same type,
 * we cannot make them into type refs. Or if any of the {@link Ref}
 * says they cannot be in type refs, we cannot do that either.
 *
 * TODO: just checking if the refs are the same is not suffice.
 * If two refs derive from each other, they cannot form a list of refs
 * (because of a possible ambiguity).
 */
private Mode canBeTypeRefs() {
    Set<NType> types = new HashSet<NType>();

    collectionMode = mul.isAtMostOnce()?NOT_REPEATED:REPEATED_ELEMENT;

    // the way we compute this is that we start from the most optimistic value,
    // and then gradually degrade as we find something problematic.
    Mode mode = Mode.SHOULD_BE_TYPEREF;

    for( Ref r : refs ) {
        mode = mode.or(r.canBeType(this));
        if(mode== Mode.MUST_BE_REFERENCE)
            return mode;    // no need to continue the processing

        if(!types.add(r.toTypeRef(null).getTarget().getType()))
            return Mode.MUST_BE_REFERENCE;   // collision
        if(r.isListOfValues()) {
            if(refs.size()>1 || !mul.isAtMostOnce())
                return Mode.MUST_BE_REFERENCE;   // restriction on @XmlList
            collectionMode = REPEATED_VALUE;
        }
    }
    return mode;
}
 
Example #10
Source File: CElementInfo.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
public NType getContentInMemoryType() {
    if(getProperty().getAdapter()==null) {
        NType itemType = getContentType().getType();
        if(!property.isCollection())
            return itemType;

        return NavigatorImpl.createParameterizedType(List.class,itemType);
    } else {
        return getProperty().getAdapter().customType;
    }
}
 
Example #11
Source File: CElementInfo.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
public NType getContentInMemoryType() {
    if(getProperty().getAdapter()==null) {
        NType itemType = getContentType().getType();
        if(!property.isCollection())
            return itemType;

        return NavigatorImpl.createParameterizedType(List.class,itemType);
    } else {
        return getProperty().getAdapter().customType;
    }
}
 
Example #12
Source File: CElementInfo.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
public NType getContentInMemoryType() {
    if(getProperty().getAdapter()==null) {
        NType itemType = getContentType().getType();
        if(!property.isCollection())
            return itemType;

        return NavigatorImpl.createParameterizedType(List.class,itemType);
    } else {
        return getProperty().getAdapter().customType;
    }
}
 
Example #13
Source File: Model.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
public Map<NType, ? extends CBuiltinLeafInfo> builtins() {
    return CBuiltinLeafInfo.LEAVES;
}
 
Example #14
Source File: Model.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
public CNonElement getTypeInfo(NType type) {
    CBuiltinLeafInfo leaf = CBuiltinLeafInfo.LEAVES.get(type);
    if(leaf!=null)      return leaf;

    return getClassInfo(getNavigator().asDecl(type));
}
 
Example #15
Source File: CTypeRef.java    From hottub with GNU General Public License v2.0 4 votes vote down vote up
public PropertyInfo<NType, NClass> getSource() {
    // TODO: implement this method later
    throw new UnsupportedOperationException();
}
 
Example #16
Source File: CClassInfo.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
public Element<NType,NClass> asElement() {
    if(isElement())
        return this;
    else
        return null;
}
 
Example #17
Source File: CEnumLeafInfo.java    From hottub with GNU General Public License v2.0 4 votes vote down vote up
public Element<NType,NClass> asElement() {
    return null;
}
 
Example #18
Source File: CEnumLeafInfo.java    From openjdk-8-source with GNU General Public License v2.0 4 votes vote down vote up
public NType getType() {
    return this;
}
 
Example #19
Source File: Model.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
public CNonElement getTypeInfo(NType type) {
    CBuiltinLeafInfo leaf = CBuiltinLeafInfo.LEAVES.get(type);
    if(leaf!=null)      return leaf;

    return getClassInfo(getNavigator().asDecl(type));
}
 
Example #20
Source File: CEnumLeafInfo.java    From openjdk-8 with GNU General Public License v2.0 4 votes vote down vote up
public NType getType() {
    return this;
}
 
Example #21
Source File: CElementInfo.java    From openjdk-8 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * @deprecated why are you calling a method that returns this?
 */
public NType getType() {
    return this;
}
 
Example #22
Source File: CBuiltinLeafInfo.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 4 votes vote down vote up
private CBuiltinLeafInfo(NType typeToken, ID id, QName... typeNames) {
    this.type = typeToken;
    this.typeName = typeNames.length>0?typeNames[0]:null;
    this.typeNames = typeNames;
    this.id = id;
}
 
Example #23
Source File: Model.java    From openjdk-8 with GNU General Public License v2.0 4 votes vote down vote up
public Map<NType, ? extends CBuiltinLeafInfo> builtins() {
    return CBuiltinLeafInfo.LEAVES;
}
 
Example #24
Source File: CClassRef.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
public NType getType() {
    return this;
}
 
Example #25
Source File: CEnumLeafInfo.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
public NonElement<NType,NClass> getBaseType() {
    return base;
}
 
Example #26
Source File: CEnumLeafInfo.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
public NType getType() {
    return this;
}
 
Example #27
Source File: CEnumLeafInfo.java    From hottub with GNU General Public License v2.0 4 votes vote down vote up
public NonElement<NType,NClass> getBaseType() {
    return base;
}
 
Example #28
Source File: CTypeRef.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
public PropertyInfo<NType, NClass> getSource() {
    // TODO: implement this method later
    throw new UnsupportedOperationException();
}
 
Example #29
Source File: CBuiltinLeafInfo.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
/**
 * A reference to the representation of the type.
 */
public NType getType() {
    return type;
}
 
Example #30
Source File: CBuiltinLeafInfo.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
/**
 * @deprecated always return null at this level.
 */
public final Element<NType,NClass> asElement() {
    return null;
}