com.sun.tools.internal.xjc.reader.RawTypeSet Java Examples

The following examples show how to use com.sun.tools.internal.xjc.reader.RawTypeSet. 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: MultiWildcardComplexTypeBuilder.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
public void build(XSComplexType ct) {
    XSContentType contentType = ct.getContentType();

    builder.recordBindingMode(ct, FALLBACK_CONTENT);
    BIProperty prop = BIProperty.getCustomization(ct);

    CPropertyInfo p;

    if(contentType.asEmpty()!=null) {
        p = prop.createValueProperty("Content",false,ct,CBuiltinLeafInfo.STRING,null);
    } else {
        RawTypeSet ts = RawTypeSetBuilder.build(contentType.asParticle(),false);
        p = prop.createReferenceProperty("Content", false, ct, ts, true, false, true, false);
    }

    selector.getCurrentBean().addProperty(p);

    // adds attributes and we are through.
    green.attContainer(ct);
}
 
Example #2
Source File: MultiWildcardComplexTypeBuilder.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
public void build(XSComplexType ct) {
    XSContentType contentType = ct.getContentType();

    builder.recordBindingMode(ct, FALLBACK_CONTENT);
    BIProperty prop = BIProperty.getCustomization(ct);

    CPropertyInfo p;

    if(contentType.asEmpty()!=null) {
        p = prop.createValueProperty("Content",false,ct,CBuiltinLeafInfo.STRING,null);
    } else {
        RawTypeSet ts = RawTypeSetBuilder.build(contentType.asParticle(),false);
        p = prop.createReferenceProperty("Content", false, ct, ts, true, false, true, false);
    }

    selector.getCurrentBean().addProperty(p);

    // adds attributes and we are through.
    green.attContainer(ct);
}
 
Example #3
Source File: MultiWildcardComplexTypeBuilder.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
public void build(XSComplexType ct) {
    XSContentType contentType = ct.getContentType();

    builder.recordBindingMode(ct, FALLBACK_CONTENT);
    BIProperty prop = BIProperty.getCustomization(ct);

    CPropertyInfo p;

    if(contentType.asEmpty()!=null) {
        p = prop.createValueProperty("Content",false,ct,CBuiltinLeafInfo.STRING,null);
    } else {
        RawTypeSet ts = RawTypeSetBuilder.build(contentType.asParticle(),false);
        p = prop.createReferenceProperty("Content", false, ct, ts, true, false, true, false);
    }

    selector.getCurrentBean().addProperty(p);

    // adds attributes and we are through.
    green.attContainer(ct);
}
 
Example #4
Source File: RawTypeSetBuilder.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
protected RawTypeSet.Mode canBeType(RawTypeSet parent) {
    // if we have an adapter or IDness, which requires special
    // annotation, and there's more than one element,
    // we have no place to put the special annotation, so we need JAXBElement.
    if((parent.refs.size()>1 || !parent.mul.isAtMostOnce()) && target.idUse()!=ID.NONE)
        return RawTypeSet.Mode.MUST_BE_REFERENCE;
    if(parent.refs.size() > 1 && target.getAdapterUse() != null)
        return RawTypeSet.Mode.MUST_BE_REFERENCE;

    // nillable and optional at the same time. needs an element wrapper to distinguish those
    // two states. But this is not a hard requirement.
    if(decl.isNillable() && parent.mul.isOptional())
        return RawTypeSet.Mode.CAN_BE_TYPEREF;

    return RawTypeSet.Mode.SHOULD_BE_TYPEREF;
}
 
Example #5
Source File: RawTypeSetBuilder.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
protected RawTypeSet.Mode canBeType(RawTypeSet parent) {
    // if we have an adapter or IDness, which requires special
    // annotation, and there's more than one element,
    // we have no place to put the special annotation, so we need JAXBElement.
    if((parent.refs.size()>1 || !parent.mul.isAtMostOnce()) && target.idUse()!=ID.NONE)
        return RawTypeSet.Mode.MUST_BE_REFERENCE;
    if(parent.refs.size() > 1 && target.getAdapterUse() != null)
        return RawTypeSet.Mode.MUST_BE_REFERENCE;

    // nillable and optional at the same time. needs an element wrapper to distinguish those
    // two states. But this is not a hard requirement.
    if(decl.isNillable() && parent.mul.isOptional())
        return RawTypeSet.Mode.CAN_BE_TYPEREF;

    return RawTypeSet.Mode.SHOULD_BE_TYPEREF;
}
 
Example #6
Source File: MultiWildcardComplexTypeBuilder.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
public void build(XSComplexType ct) {
    XSContentType contentType = ct.getContentType();

    builder.recordBindingMode(ct, FALLBACK_CONTENT);
    BIProperty prop = BIProperty.getCustomization(ct);

    CPropertyInfo p;

    if(contentType.asEmpty()!=null) {
        p = prop.createValueProperty("Content",false,ct,CBuiltinLeafInfo.STRING,null);
    } else {
        RawTypeSet ts = RawTypeSetBuilder.build(contentType.asParticle(),false);
        p = prop.createReferenceProperty("Content", false, ct, ts, true, false, true, false);
    }

    selector.getCurrentBean().addProperty(p);

    // adds attributes and we are through.
    green.attContainer(ct);
}
 
Example #7
Source File: RawTypeSetBuilder.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
protected RawTypeSet.Mode canBeType(RawTypeSet parent) {
    // if we have an adapter or IDness, which requires special
    // annotation, and there's more than one element,
    // we have no place to put the special annotation, so we need JAXBElement.
    if((parent.refs.size()>1 || !parent.mul.isAtMostOnce()) && target.idUse()!=ID.NONE)
        return RawTypeSet.Mode.MUST_BE_REFERENCE;
    if(parent.refs.size() > 1 && target.getAdapterUse() != null)
        return RawTypeSet.Mode.MUST_BE_REFERENCE;

    // nillable and optional at the same time. needs an element wrapper to distinguish those
    // two states. But this is not a hard requirement.
    if(decl.isNillable() && parent.mul.isOptional())
        return RawTypeSet.Mode.CAN_BE_TYPEREF;

    return RawTypeSet.Mode.SHOULD_BE_TYPEREF;
}
 
Example #8
Source File: MultiWildcardComplexTypeBuilder.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
public void build(XSComplexType ct) {
    XSContentType contentType = ct.getContentType();

    builder.recordBindingMode(ct, FALLBACK_CONTENT);
    BIProperty prop = BIProperty.getCustomization(ct);

    CPropertyInfo p;

    if(contentType.asEmpty()!=null) {
        p = prop.createValueProperty("Content",false,ct,CBuiltinLeafInfo.STRING,null);
    } else {
        RawTypeSet ts = RawTypeSetBuilder.build(contentType.asParticle(),false);
        p = prop.createReferenceProperty("Content", false, ct, ts, true, false, true, false);
    }

    selector.getCurrentBean().addProperty(p);

    // adds attributes and we are through.
    green.attContainer(ct);
}
 
Example #9
Source File: RawTypeSetBuilder.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
protected RawTypeSet.Mode canBeType(RawTypeSet parent) {
    // if we have an adapter or IDness, which requires special
    // annotation, and there's more than one element,
    // we have no place to put the special annotation, so we need JAXBElement.
    if((parent.refs.size()>1 || !parent.mul.isAtMostOnce()) && target.idUse()!=ID.NONE)
        return RawTypeSet.Mode.MUST_BE_REFERENCE;
    if(parent.refs.size() > 1 && target.getAdapterUse() != null)
        return RawTypeSet.Mode.MUST_BE_REFERENCE;

    // nillable and optional at the same time. needs an element wrapper to distinguish those
    // two states. But this is not a hard requirement.
    if(decl.isNillable() && parent.mul.isOptional())
        return RawTypeSet.Mode.CAN_BE_TYPEREF;

    return RawTypeSet.Mode.SHOULD_BE_TYPEREF;
}
 
Example #10
Source File: MultiWildcardComplexTypeBuilder.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
public void build(XSComplexType ct) {
    XSContentType contentType = ct.getContentType();

    builder.recordBindingMode(ct, FALLBACK_CONTENT);
    BIProperty prop = BIProperty.getCustomization(ct);

    CPropertyInfo p;

    if(contentType.asEmpty()!=null) {
        p = prop.createValueProperty("Content",false,ct,CBuiltinLeafInfo.STRING,null);
    } else {
        RawTypeSet ts = RawTypeSetBuilder.build(contentType.asParticle(),false);
        p = prop.createReferenceProperty("Content", false, ct, ts, true, false, true, false);
    }

    selector.getCurrentBean().addProperty(p);

    // adds attributes and we are through.
    green.attContainer(ct);
}
 
Example #11
Source File: MultiWildcardComplexTypeBuilder.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
public void build(XSComplexType ct) {
    XSContentType contentType = ct.getContentType();

    builder.recordBindingMode(ct, FALLBACK_CONTENT);
    BIProperty prop = BIProperty.getCustomization(ct);

    CPropertyInfo p;

    if(contentType.asEmpty()!=null) {
        p = prop.createValueProperty("Content",false,ct,CBuiltinLeafInfo.STRING,null);
    } else {
        RawTypeSet ts = RawTypeSetBuilder.build(contentType.asParticle(),false);
        p = prop.createReferenceProperty("Content", false, ct, ts, true, false, true, false);
    }

    selector.getCurrentBean().addProperty(p);

    // adds attributes and we are through.
    green.attContainer(ct);
}
 
Example #12
Source File: RawTypeSetBuilder.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
protected RawTypeSet.Mode canBeType(RawTypeSet parent) {
    // if we have an adapter or IDness, which requires special
    // annotation, and there's more than one element,
    // we have no place to put the special annotation, so we need JAXBElement.
    if((parent.refs.size()>1 || !parent.mul.isAtMostOnce()) && target.idUse()!=ID.NONE)
        return RawTypeSet.Mode.MUST_BE_REFERENCE;
    if(parent.refs.size() > 1 && target.getAdapterUse() != null)
        return RawTypeSet.Mode.MUST_BE_REFERENCE;

    // nillable and optional at the same time. needs an element wrapper to distinguish those
    // two states. But this is not a hard requirement.
    if(decl.isNillable() && parent.mul.isOptional())
        return RawTypeSet.Mode.CAN_BE_TYPEREF;

    return RawTypeSet.Mode.SHOULD_BE_TYPEREF;
}
 
Example #13
Source File: MultiWildcardComplexTypeBuilder.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
public void build(XSComplexType ct) {
    XSContentType contentType = ct.getContentType();

    builder.recordBindingMode(ct, FALLBACK_CONTENT);
    BIProperty prop = BIProperty.getCustomization(ct);

    CPropertyInfo p;

    if(contentType.asEmpty()!=null) {
        p = prop.createValueProperty("Content",false,ct,CBuiltinLeafInfo.STRING,null);
    } else {
        RawTypeSet ts = RawTypeSetBuilder.build(contentType.asParticle(),false);
        p = prop.createReferenceProperty("Content", false, ct, ts, true, false, true, false);
    }

    selector.getCurrentBean().addProperty(p);

    // adds attributes and we are through.
    green.attContainer(ct);
}
 
Example #14
Source File: RawTypeSetBuilder.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * @param optional
 *      if this whole property is optional due to the
 *      occurrence constraints on ancestors, set this to true.
 *      this will prevent the primitive types to be generated.
 */
public static RawTypeSet build( XSParticle p, boolean optional ) {
    RawTypeSetBuilder rtsb = new RawTypeSetBuilder();
    rtsb.particle(p);
    Multiplicity mul = MultiplicityCounter.theInstance.particle(p);

    if(optional)
        mul = mul.makeOptional();

    return new RawTypeSet(rtsb.refs,mul);
}
 
Example #15
Source File: BIProperty.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
public CReferencePropertyInfo createContentExtendedMixedReferenceProperty(
        String defaultName, XSComponent source, RawTypeSet types) {
        return createReferenceProperty(
                defaultName,
                false,
                source,
                types,
                true,
                false,
                true,
                true);
}
 
Example #16
Source File: BIProperty.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
public CReferencePropertyInfo createReferenceProperty(
        String defaultName, boolean forConstant, XSComponent source,
        RawTypeSet types, boolean isMixed, boolean dummy, boolean content, boolean isMixedExtended) {

    if (types == null) {    // this is a special case where we need to generate content because potential subtypes would need to be able to override what's store inside
        content = true;
    } else {
        if(!types.refs.isEmpty())
            // if this property is empty, don't acknowleedge the customization
            // this allows pointless property customization to be reported as an error
            markAsAcknowledged();
    }
    constantPropertyErrorCheck();

    String name = getPropertyName(forConstant);
    if(name==null)
        name = defaultName;

    CReferencePropertyInfo prop = wrapUp(
                                        new CReferencePropertyInfo(
                                            name,
                                            (types == null) ? true : types.getCollectionMode().isRepeated()||isMixed,
                                            (types == null) ? false : types.isRequired(),
                                            isMixed,
                                            source,
                                            getCustomizations(source), source.getLocator(), dummy, content, isMixedExtended),
                                    source);
    if (types != null) {
        types.addTo(prop);
    }

    BIInlineBinaryData.handle(source, prop);
    return prop;
}
 
Example #17
Source File: BIProperty.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
public CReferencePropertyInfo createContentExtendedMixedReferenceProperty(
        String defaultName, XSComponent source, RawTypeSet types) {
        return createReferenceProperty(
                defaultName,
                false,
                source,
                types,
                true,
                false,
                true,
                true);
}
 
Example #18
Source File: BIProperty.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
/**
 *
 *
 * @param defaultName
 *      If the name is not customized, this name will be used
 *      as the default. Note that the name conversion <b>MUST</b>
 *      be applied before this method is called if necessary.
 * @param source
 *      Source schema component from which a field is built.
 */
public CElementPropertyInfo createElementProperty(String defaultName, boolean forConstant, XSParticle source,
                                                  RawTypeSet types) {

    if(!types.refs.isEmpty())
        // if this property is empty, don't acknowleedge the customization
        // this allows pointless property customization to be reported as an error
        markAsAcknowledged();
    constantPropertyErrorCheck();

    String name = getPropertyName(forConstant);
    if(name==null)
        name = defaultName;

    CElementPropertyInfo prop = wrapUp(
        new CElementPropertyInfo(
            name, types.getCollectionMode(),
            types.id(),
            types.getExpectedMimeType(),
            source, getCustomizations(source),
            source.getLocator(), types.isRequired()),
        source);

    types.addTo(prop);

    BIInlineBinaryData.handle(source.getTerm(), prop);
    return prop;
}
 
Example #19
Source File: BIProperty.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 *
 *
 * @param defaultName
 *      If the name is not customized, this name will be used
 *      as the default. Note that the name conversion <b>MUST</b>
 *      be applied before this method is called if necessary.
 * @param source
 *      Source schema component from which a field is built.
 */
public CElementPropertyInfo createElementProperty(String defaultName, boolean forConstant, XSParticle source,
                                                  RawTypeSet types) {

    if(!types.refs.isEmpty())
        // if this property is empty, don't acknowleedge the customization
        // this allows pointless property customization to be reported as an error
        markAsAcknowledged();
    constantPropertyErrorCheck();

    String name = getPropertyName(forConstant);
    if(name==null)
        name = defaultName;

    CElementPropertyInfo prop = wrapUp(
        new CElementPropertyInfo(
            name, types.getCollectionMode(),
            types.id(),
            types.getExpectedMimeType(),
            source, getCustomizations(source),
            source.getLocator(), types.isRequired()),
        source);

    types.addTo(prop);

    BIInlineBinaryData.handle(source.getTerm(), prop);
    return prop;
}
 
Example #20
Source File: BIProperty.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
public CReferencePropertyInfo createContentExtendedMixedReferenceProperty(
        String defaultName, XSComponent source, RawTypeSet types) {
        return createReferenceProperty(
                defaultName,
                false,
                source,
                types,
                true,
                false,
                true,
                true);
}
 
Example #21
Source File: BIProperty.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
public CReferencePropertyInfo createDummyExtendedMixedReferenceProperty(
        String defaultName, XSComponent source, RawTypeSet types) {
        return createReferenceProperty(
                defaultName,
                false,
                source,
                types,
                true,
                true,
                false,
                true);
}
 
Example #22
Source File: BIProperty.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
/**
 *
 *
 * @param defaultName
 *      If the name is not customized, this name will be used
 *      as the default. Note that the name conversion <b>MUST</b>
 *      be applied before this method is called if necessary.
 * @param source
 *      Source schema component from which a field is built.
 */
public CElementPropertyInfo createElementProperty(String defaultName, boolean forConstant, XSParticle source,
                                                  RawTypeSet types) {

    if(!types.refs.isEmpty())
        // if this property is empty, don't acknowleedge the customization
        // this allows pointless property customization to be reported as an error
        markAsAcknowledged();
    constantPropertyErrorCheck();

    String name = getPropertyName(forConstant);
    if(name==null)
        name = defaultName;

    CElementPropertyInfo prop = wrapUp(
        new CElementPropertyInfo(
            name, types.getCollectionMode(),
            types.id(),
            types.getExpectedMimeType(),
            source, getCustomizations(source),
            source.getLocator(), types.isRequired()),
        source);

    types.addTo(prop);

    BIInlineBinaryData.handle(source.getTerm(), prop);
    return prop;
}
 
Example #23
Source File: RawTypeSetBuilder.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
protected RawTypeSet.Mode canBeType(RawTypeSet parent) {
    // if element substitution can occur, no way it can be mapped to a list of types
    if(decl.getSubstitutables().size()>1)
        return RawTypeSet.Mode.MUST_BE_REFERENCE;

    return RawTypeSet.Mode.SHOULD_BE_TYPEREF;
}
 
Example #24
Source File: RawTypeSetBuilder.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
protected RawTypeSet.Mode canBeType(RawTypeSet parent) {
    // if element substitution can occur, no way it can be mapped to a list of types
    if(decl.getSubstitutables().size()>1)
        return RawTypeSet.Mode.MUST_BE_REFERENCE;
    // BIXSubstitutable also simulates this effect. Useful for separate compilation
    BIXSubstitutable subst = builder.getBindInfo(decl).get(BIXSubstitutable.class);
    if(subst!=null) {
        subst.markAsAcknowledged();
        return RawTypeSet.Mode.MUST_BE_REFERENCE;
    }

    // we have no place to put an adater if this thing maps to a type
    CElementPropertyInfo p = target.getProperty();
    // if we have an adapter or IDness, which requires special
    // annotation, and there's more than one element,
    // we have no place to put the special annotation, so we need JAXBElement.
    if((parent.refs.size()>1 || !parent.mul.isAtMostOnce()) && p.id()!=ID.NONE)
        return RawTypeSet.Mode.MUST_BE_REFERENCE;
    if(parent.refs.size() > 1 && p.getAdapter() != null)
        return RawTypeSet.Mode.MUST_BE_REFERENCE;

    if(target.hasClass())
        // if the CElementInfo was explicitly bound to a class (which happen if and only if
        // the user requested so, then map that to reference property so that the user sees a class
        return RawTypeSet.Mode.CAN_BE_TYPEREF;
    else
        return RawTypeSet.Mode.SHOULD_BE_TYPEREF;
}
 
Example #25
Source File: BIProperty.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
public CReferencePropertyInfo createReferenceProperty(
        String defaultName, boolean forConstant, XSComponent source,
        RawTypeSet types, boolean isMixed, boolean dummy, boolean content, boolean isMixedExtended) {

    if (types == null) {    // this is a special case where we need to generate content because potential subtypes would need to be able to override what's store inside
        content = true;
    } else {
        if(!types.refs.isEmpty())
            // if this property is empty, don't acknowleedge the customization
            // this allows pointless property customization to be reported as an error
            markAsAcknowledged();
    }
    constantPropertyErrorCheck();

    String name = getPropertyName(forConstant);
    if(name==null)
        name = defaultName;

    CReferencePropertyInfo prop = wrapUp(
                                        new CReferencePropertyInfo(
                                            name,
                                            (types == null) ? true : types.getCollectionMode().isRepeated()||isMixed,
                                            (types == null) ? false : types.isRequired(),
                                            isMixed,
                                            source,
                                            getCustomizations(source), source.getLocator(), dummy, content, isMixedExtended),
                                    source);
    if (types != null) {
        types.addTo(prop);
    }

    BIInlineBinaryData.handle(source, prop);
    return prop;
}
 
Example #26
Source File: RawTypeSetBuilder.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
protected RawTypeSet.Mode canBeType(RawTypeSet parent) {
    // if element substitution can occur, no way it can be mapped to a list of types
    if(decl.getSubstitutables().size()>1)
        return RawTypeSet.Mode.MUST_BE_REFERENCE;

    return RawTypeSet.Mode.SHOULD_BE_TYPEREF;
}
 
Example #27
Source File: RawTypeSetBuilder.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
protected RawTypeSet.Mode canBeType(RawTypeSet parent) {
    // if element substitution can occur, no way it can be mapped to a list of types
    if(decl.getSubstitutables().size()>1)
        return RawTypeSet.Mode.MUST_BE_REFERENCE;
    // BIXSubstitutable also simulates this effect. Useful for separate compilation
    BIXSubstitutable subst = builder.getBindInfo(decl).get(BIXSubstitutable.class);
    if(subst!=null) {
        subst.markAsAcknowledged();
        return RawTypeSet.Mode.MUST_BE_REFERENCE;
    }

    // we have no place to put an adater if this thing maps to a type
    CElementPropertyInfo p = target.getProperty();
    // if we have an adapter or IDness, which requires special
    // annotation, and there's more than one element,
    // we have no place to put the special annotation, so we need JAXBElement.
    if((parent.refs.size()>1 || !parent.mul.isAtMostOnce()) && p.id()!=ID.NONE)
        return RawTypeSet.Mode.MUST_BE_REFERENCE;
    if(parent.refs.size() > 1 && p.getAdapter() != null)
        return RawTypeSet.Mode.MUST_BE_REFERENCE;

    if(target.hasClass())
        // if the CElementInfo was explicitly bound to a class (which happen if and only if
        // the user requested so, then map that to reference property so that the user sees a class
        return RawTypeSet.Mode.CAN_BE_TYPEREF;
    else
        return RawTypeSet.Mode.SHOULD_BE_TYPEREF;
}
 
Example #28
Source File: RawTypeSetBuilder.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
protected RawTypeSet.Mode canBeType(RawTypeSet parent) {
    // if element substitution can occur, no way it can be mapped to a list of types
    if(decl.getSubstitutables().size()>1)
        return RawTypeSet.Mode.MUST_BE_REFERENCE;

    return RawTypeSet.Mode.SHOULD_BE_TYPEREF;
}
 
Example #29
Source File: RawTypeSetBuilder.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
protected RawTypeSet.Mode canBeType(RawTypeSet parent) {
    // if element substitution can occur, no way it can be mapped to a list of types
    if(decl.getSubstitutables().size()>1)
        return RawTypeSet.Mode.MUST_BE_REFERENCE;

    return RawTypeSet.Mode.SHOULD_BE_TYPEREF;
}
 
Example #30
Source File: BIProperty.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
public CPropertyInfo createElementOrReferenceProperty(
        String defaultName, boolean forConstant, XSParticle source,
        RawTypeSet types) {

    boolean generateRef;

    switch(types.canBeTypeRefs) {
    case CAN_BE_TYPEREF:
    case SHOULD_BE_TYPEREF:
        // it's up to the use
        Boolean b = generateElementProperty();
        if(b==null) // follow XJC recommendation
            generateRef = types.canBeTypeRefs== RawTypeSet.Mode.CAN_BE_TYPEREF;
        else // use the value user gave us
            generateRef = b;
        break;
    case MUST_BE_REFERENCE:
        generateRef = true;
        break;
    default:
        throw new AssertionError();
    }

    if(generateRef) {
        return createReferenceProperty(defaultName,forConstant,source,types, false, false, false, false);
    } else {
        return createElementProperty(defaultName,forConstant,source,types);
    }
}