com.sun.tools.internal.xjc.model.CReferencePropertyInfo Java Examples

The following examples show how to use com.sun.tools.internal.xjc.model.CReferencePropertyInfo. 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: RawTypeSetBuilder.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * The whole type set can be later bound to a reference property,
 * in which case we need to generate additional code to wrap this
 * type reference into an element class.
 *
 * This method generates such an element class and returns it.
 */
protected void toElementRef(CReferencePropertyInfo prop) {
    CClassInfo scope = Ring.get(ClassSelector.class).getCurrentBean();
    Model model = Ring.get(Model.class);

    CCustomizations custs = Ring.get(BGMBuilder.class).getBindInfo(decl).toCustomizationList();

    if(target instanceof CClassInfo && Ring.get(BIGlobalBinding.class).isSimpleMode()) {
        CClassInfo bean = new CClassInfo(model,scope,
                        model.getNameConverter().toClassName(decl.getName()),
                        decl.getLocator(), null, BGMBuilder.getName(decl), decl,
                        custs);
        bean.setBaseClass((CClassInfo)target);
        prop.getElements().add(bean);
    } else {
        CElementInfo e = new CElementInfo(model,BGMBuilder.getName(decl),scope,target,
                decl.getDefaultValue(), decl, custs, decl.getLocator());
        prop.getElements().add(e);
    }
}
 
Example #2
Source File: RawTypeSetBuilder.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
/**
 * The whole type set can be later bound to a reference property,
 * in which case we need to generate additional code to wrap this
 * type reference into an element class.
 *
 * This method generates such an element class and returns it.
 */
protected void toElementRef(CReferencePropertyInfo prop) {
    CClassInfo scope = Ring.get(ClassSelector.class).getCurrentBean();
    Model model = Ring.get(Model.class);

    CCustomizations custs = Ring.get(BGMBuilder.class).getBindInfo(decl).toCustomizationList();

    if(target instanceof CClassInfo && Ring.get(BIGlobalBinding.class).isSimpleMode()) {
        CClassInfo bean = new CClassInfo(model,scope,
                        model.getNameConverter().toClassName(decl.getName()),
                        decl.getLocator(), null, BGMBuilder.getName(decl), decl,
                        custs);
        bean.setBaseClass((CClassInfo)target);
        prop.getElements().add(bean);
    } else {
        CElementInfo e = new CElementInfo(model,BGMBuilder.getName(decl),scope,target,
                decl.getDefaultValue(), decl, custs, decl.getLocator());
        prop.getElements().add(e);
    }
}
 
Example #3
Source File: DefaultParticleBinder.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
@Override
public void build( XSParticle p, Collection<XSParticle> forcedProps ) {
    Checker checker = checkCollision(p,forcedProps);

    if(checker.hasNameCollision()) {
        CReferencePropertyInfo prop = new CReferencePropertyInfo(
            getCurrentBean().getBaseClass()==null?"Content":"Rest",
            true, false, false, p,
            builder.getBindInfo(p).toCustomizationList(),
            p.getLocator(), false, false, false);
        RawTypeSetBuilder.build(p,false).addTo(prop);
        prop.javadoc = Messages.format( Messages.MSG_FALLBACK_JAVADOC,
                checker.getCollisionInfo().toString() );

        getCurrentBean().addProperty(prop);
    } else {
        new Builder(checker.markedParticles).particle(p);
    }
}
 
Example #4
Source File: DefaultParticleBinder.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
@Override
public void build( XSParticle p, Collection<XSParticle> forcedProps ) {
    Checker checker = checkCollision(p,forcedProps);

    if(checker.hasNameCollision()) {
        CReferencePropertyInfo prop = new CReferencePropertyInfo(
            getCurrentBean().getBaseClass()==null?"Content":"Rest",
            true, false, false, p,
            builder.getBindInfo(p).toCustomizationList(),
            p.getLocator(), false, false, false);
        RawTypeSetBuilder.build(p,false).addTo(prop);
        prop.javadoc = Messages.format( Messages.MSG_FALLBACK_JAVADOC,
                checker.getCollisionInfo().toString() );

        getCurrentBean().addProperty(prop);
    } else {
        new Builder(checker.markedParticles).particle(p);
    }
}
 
Example #5
Source File: DefaultParticleBinder.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
@Override
public void build( XSParticle p, Collection<XSParticle> forcedProps ) {
    Checker checker = checkCollision(p,forcedProps);

    if(checker.hasNameCollision()) {
        CReferencePropertyInfo prop = new CReferencePropertyInfo(
            getCurrentBean().getBaseClass()==null?"Content":"Rest",
            true, false, false, p,
            builder.getBindInfo(p).toCustomizationList(),
            p.getLocator(), false, false, false);
        RawTypeSetBuilder.build(p,false).addTo(prop);
        prop.javadoc = Messages.format( Messages.MSG_FALLBACK_JAVADOC,
                checker.getCollisionInfo().toString() );

        getCurrentBean().addProperty(prop);
    } else {
        new Builder(checker.markedParticles).particle(p);
    }
}
 
Example #6
Source File: RawTypeSetBuilder.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
/**
 * The whole type set can be later bound to a reference property,
 * in which case we need to generate additional code to wrap this
 * type reference into an element class.
 *
 * This method generates such an element class and returns it.
 */
protected void toElementRef(CReferencePropertyInfo prop) {
    CClassInfo scope = Ring.get(ClassSelector.class).getCurrentBean();
    Model model = Ring.get(Model.class);

    CCustomizations custs = Ring.get(BGMBuilder.class).getBindInfo(decl).toCustomizationList();

    if(target instanceof CClassInfo && Ring.get(BIGlobalBinding.class).isSimpleMode()) {
        CClassInfo bean = new CClassInfo(model,scope,
                        model.getNameConverter().toClassName(decl.getName()),
                        decl.getLocator(), null, BGMBuilder.getName(decl), decl,
                        custs);
        bean.setBaseClass((CClassInfo)target);
        prop.getElements().add(bean);
    } else {
        CElementInfo e = new CElementInfo(model,BGMBuilder.getName(decl),scope,target,
                decl.getDefaultValue(), decl, custs, decl.getLocator());
        prop.getElements().add(e);
    }
}
 
Example #7
Source File: RawTypeSetBuilder.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * The whole type set can be later bound to a reference property,
 * in which case we need to generate additional code to wrap this
 * type reference into an element class.
 *
 * This method generates such an element class and returns it.
 */
protected void toElementRef(CReferencePropertyInfo prop) {
    CClassInfo scope = Ring.get(ClassSelector.class).getCurrentBean();
    Model model = Ring.get(Model.class);

    CCustomizations custs = Ring.get(BGMBuilder.class).getBindInfo(decl).toCustomizationList();

    if(target instanceof CClassInfo && Ring.get(BIGlobalBinding.class).isSimpleMode()) {
        CClassInfo bean = new CClassInfo(model,scope,
                        model.getNameConverter().toClassName(decl.getName()),
                        decl.getLocator(), null, BGMBuilder.getName(decl), decl,
                        custs);
        bean.setBaseClass((CClassInfo)target);
        prop.getElements().add(bean);
    } else {
        CElementInfo e = new CElementInfo(model,BGMBuilder.getName(decl),scope,target,
                decl.getDefaultValue(), decl, custs, decl.getLocator());
        prop.getElements().add(e);
    }
}
 
Example #8
Source File: DefaultParticleBinder.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
@Override
public void build( XSParticle p, Collection<XSParticle> forcedProps ) {
    Checker checker = checkCollision(p,forcedProps);

    if(checker.hasNameCollision()) {
        CReferencePropertyInfo prop = new CReferencePropertyInfo(
            getCurrentBean().getBaseClass()==null?"Content":"Rest",
            true, false, false, p,
            builder.getBindInfo(p).toCustomizationList(),
            p.getLocator(), false, false, false);
        RawTypeSetBuilder.build(p,false).addTo(prop);
        prop.javadoc = Messages.format( Messages.MSG_FALLBACK_JAVADOC,
                checker.getCollisionInfo().toString() );

        getCurrentBean().addProperty(prop);
    } else {
        new Builder(checker.markedParticles).particle(p);
    }
}
 
Example #9
Source File: DefaultParticleBinder.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
@Override
public void build( XSParticle p, Collection<XSParticle> forcedProps ) {
    Checker checker = checkCollision(p,forcedProps);

    if(checker.hasNameCollision()) {
        CReferencePropertyInfo prop = new CReferencePropertyInfo(
            getCurrentBean().getBaseClass()==null?"Content":"Rest",
            true, false, false, p,
            builder.getBindInfo(p).toCustomizationList(),
            p.getLocator(), false, false, false);
        RawTypeSetBuilder.build(p,false).addTo(prop);
        prop.javadoc = Messages.format( Messages.MSG_FALLBACK_JAVADOC,
                checker.getCollisionInfo().toString() );

        getCurrentBean().addProperty(prop);
    } else {
        new Builder(checker.markedParticles).particle(p);
    }
}
 
Example #10
Source File: RawTypeSetBuilder.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * The whole type set can be later bound to a reference property,
 * in which case we need to generate additional code to wrap this
 * type reference into an element class.
 *
 * This method generates such an element class and returns it.
 */
protected void toElementRef(CReferencePropertyInfo prop) {
    CClassInfo scope = Ring.get(ClassSelector.class).getCurrentBean();
    Model model = Ring.get(Model.class);

    CCustomizations custs = Ring.get(BGMBuilder.class).getBindInfo(decl).toCustomizationList();

    if(target instanceof CClassInfo && Ring.get(BIGlobalBinding.class).isSimpleMode()) {
        CClassInfo bean = new CClassInfo(model,scope,
                        model.getNameConverter().toClassName(decl.getName()),
                        decl.getLocator(), null, BGMBuilder.getName(decl), decl,
                        custs);
        bean.setBaseClass((CClassInfo)target);
        prop.getElements().add(bean);
    } else {
        CElementInfo e = new CElementInfo(model,BGMBuilder.getName(decl),scope,target,
                decl.getDefaultValue(), decl, custs, decl.getLocator());
        prop.getElements().add(e);
    }
}
 
Example #11
Source File: DefaultParticleBinder.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
@Override
public void build( XSParticle p, Collection<XSParticle> forcedProps ) {
    Checker checker = checkCollision(p,forcedProps);

    if(checker.hasNameCollision()) {
        CReferencePropertyInfo prop = new CReferencePropertyInfo(
            getCurrentBean().getBaseClass()==null?"Content":"Rest",
            true, false, false, p,
            builder.getBindInfo(p).toCustomizationList(),
            p.getLocator(), false, false, false);
        RawTypeSetBuilder.build(p,false).addTo(prop);
        prop.javadoc = Messages.format( Messages.MSG_FALLBACK_JAVADOC,
                checker.getCollisionInfo().toString() );

        getCurrentBean().addProperty(prop);
    } else {
        new Builder(checker.markedParticles).particle(p);
    }
}
 
Example #12
Source File: RawTypeSetBuilder.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * The whole type set can be later bound to a reference property,
 * in which case we need to generate additional code to wrap this
 * type reference into an element class.
 *
 * This method generates such an element class and returns it.
 */
protected void toElementRef(CReferencePropertyInfo prop) {
    CClassInfo scope = Ring.get(ClassSelector.class).getCurrentBean();
    Model model = Ring.get(Model.class);

    CCustomizations custs = Ring.get(BGMBuilder.class).getBindInfo(decl).toCustomizationList();

    if(target instanceof CClassInfo && Ring.get(BIGlobalBinding.class).isSimpleMode()) {
        CClassInfo bean = new CClassInfo(model,scope,
                        model.getNameConverter().toClassName(decl.getName()),
                        decl.getLocator(), null, BGMBuilder.getName(decl), decl,
                        custs);
        bean.setBaseClass((CClassInfo)target);
        prop.getElements().add(bean);
    } else {
        CElementInfo e = new CElementInfo(model,BGMBuilder.getName(decl),scope,target,
                decl.getDefaultValue(), decl, custs, decl.getLocator());
        prop.getElements().add(e);
    }
}
 
Example #13
Source File: AbstractField.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Annotate the field according to the recipes given as {@link CPropertyInfo}.
 */
protected void annotate( JAnnotatable field ) {

    assert(field!=null);

    /*
    TODO: consider moving this logic to somewhere else
    so that it can be better shared, for how a field gets
    annotated doesn't really depend on how we generate accessors.

    so perhaps we should separate those two.
    */

    // TODO: consider a visitor
    if (prop instanceof CAttributePropertyInfo) {
        annotateAttribute(field);
    } else if (prop instanceof CElementPropertyInfo) {
        annotateElement(field);
    } else if (prop instanceof CValuePropertyInfo) {
        field.annotate(XmlValue.class);
    } else if (prop instanceof CReferencePropertyInfo) {
        annotateReference(field);
    }

    outline.parent().generateAdapterIfNecessary(prop,field);

    QName st = prop.getSchemaType();
    if(st!=null)
        field.annotate2(XmlSchemaTypeWriter.class)
            .name(st.getLocalPart())
            .namespace(st.getNamespaceURI());

    if(prop.inlineBinaryData())
        field.annotate(XmlInlineBinaryData.class);
}
 
Example #14
Source File: NoExtendedContentField.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
@Override
protected JType getType(final Aspect aspect) {
    if (Aspect.IMPLEMENTATION.equals(aspect)) {
        return super.getType(aspect);
    }

    if (prop instanceof CReferencePropertyInfo) {
        Set<CElement> elements = ((CReferencePropertyInfo)prop).getElements();
        if ((elements != null) && (elements.size() > 0)) {
            return codeModel.ref(Serializable.class);
        }
    }

    return codeModel.ref(String.class);
}
 
Example #15
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 #16
Source File: DummyListField.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Annotate the field according to the recipes given as {@link CPropertyInfo}.
 */
@Override
protected void annotate( JAnnotatable field ) {
    super.annotate(field);

    if (prop instanceof CReferencePropertyInfo) {
        CReferencePropertyInfo pref = (CReferencePropertyInfo)prop;
        if (pref.isDummy()) {
            annotateDummy(field);
        }
    }

}
 
Example #17
Source File: BIProperty.java    From openjdk-jdk8u-backup 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 #18
Source File: DefaultFieldRenderer.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
private FieldRenderer decideRenderer(ClassOutlineImpl outline, CPropertyInfo prop) {

        if (prop instanceof CReferencePropertyInfo) {
            CReferencePropertyInfo p = (CReferencePropertyInfo)prop;
            if (p.isDummy()) {
                return frf.getDummyList(outline.parent().getCodeModel().ref(ArrayList.class));
            }
            if (p.isContent() && (p.isMixedExtendedCust())) {
                return frf.getContentList(outline.parent().getCodeModel().ref(ArrayList.class).narrow(Serializable.class));
            }
        }

        if(!prop.isCollection()) {
            // non-collection field

            // TODO: check for bidning info for optionalPrimitiveType=boxed or
            // noHasMethod=false and noDeletedMethod=false
            if(prop.isUnboxable())
                // this one uses a primitive type as much as possible
                return frf.getRequiredUnboxed();
            else
                // otherwise use the default non-collection field
                return frf.getSingle();
        }

        if( defaultCollectionFieldRenderer==null ) {
            return frf.getList(outline.parent().getCodeModel().ref(ArrayList.class));
        }

        // this field is a collection field.
        // use untyped list as the default. This is consistent
        // to the JAXB spec.
        return defaultCollectionFieldRenderer;
    }
 
Example #19
Source File: BIProperty.java    From openjdk-jdk9 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 #20
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 #21
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 #22
Source File: BIProperty.java    From hottub 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 #23
Source File: AbstractField.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Annotate the field according to the recipes given as {@link CPropertyInfo}.
 */
protected void annotate( JAnnotatable field ) {

    assert(field!=null);

    /*
    TODO: consider moving this logic to somewhere else
    so that it can be better shared, for how a field gets
    annotated doesn't really depend on how we generate accessors.

    so perhaps we should separate those two.
    */

    // TODO: consider a visitor
    if (prop instanceof CAttributePropertyInfo) {
        annotateAttribute(field);
    } else if (prop instanceof CElementPropertyInfo) {
        annotateElement(field);
    } else if (prop instanceof CValuePropertyInfo) {
        field.annotate(XmlValue.class);
    } else if (prop instanceof CReferencePropertyInfo) {
        annotateReference(field);
    }

    outline.parent().generateAdapterIfNecessary(prop,field);

    QName st = prop.getSchemaType();
    if(st!=null)
        field.annotate2(XmlSchemaTypeWriter.class)
            .name(st.getLocalPart())
            .namespace(st.getNamespaceURI());

    if(prop.inlineBinaryData())
        field.annotate(XmlInlineBinaryData.class);
}
 
Example #24
Source File: BIProperty.java    From openjdk-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 #25
Source File: NoExtendedContentField.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
@Override
protected JType getType(final Aspect aspect) {
    if (Aspect.IMPLEMENTATION.equals(aspect)) {
        return super.getType(aspect);
    }

    if (prop instanceof CReferencePropertyInfo) {
        Set<CElement> elements = ((CReferencePropertyInfo)prop).getElements();
        if ((elements != null) && (elements.size() > 0)) {
            return codeModel.ref(Serializable.class);
        }
    }

    return codeModel.ref(String.class);
}
 
Example #26
Source File: DefaultFieldRenderer.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
private FieldRenderer decideRenderer(ClassOutlineImpl outline, CPropertyInfo prop) {

        if (prop instanceof CReferencePropertyInfo) {
            CReferencePropertyInfo p = (CReferencePropertyInfo)prop;
            if (p.isDummy()) {
                return frf.getDummyList(outline.parent().getCodeModel().ref(ArrayList.class));
            }
            if (p.isContent() && (p.isMixedExtendedCust())) {
                return frf.getContentList(outline.parent().getCodeModel().ref(ArrayList.class).narrow(Serializable.class));
            }
        }

        if(!prop.isCollection()) {
            // non-collection field

            // TODO: check for bidning info for optionalPrimitiveType=boxed or
            // noHasMethod=false and noDeletedMethod=false
            if(prop.isUnboxable())
                // this one uses a primitive type as much as possible
                return frf.getRequiredUnboxed();
            else
                // otherwise use the default non-collection field
                return frf.getSingle();
        }

        if( defaultCollectionFieldRenderer==null ) {
            return frf.getList(outline.parent().getCodeModel().ref(ArrayList.class));
        }

        // this field is a collection field.
        // use untyped list as the default. This is consistent
        // to the JAXB spec.
        return defaultCollectionFieldRenderer;
    }
 
Example #27
Source File: DummyListField.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Annotate the field according to the recipes given as {@link CPropertyInfo}.
 */
@Override
protected void annotate( JAnnotatable field ) {
    super.annotate(field);

    if (prop instanceof CReferencePropertyInfo) {
        CReferencePropertyInfo pref = (CReferencePropertyInfo)prop;
        if (pref.isDummy()) {
            annotateDummy(field);
        }
    }

}
 
Example #28
Source File: BIProperty.java    From openjdk-jdk8u 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 #29
Source File: BIProperty.java    From openjdk-jdk8u 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 #30
Source File: DefaultFieldRenderer.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
private FieldRenderer decideRenderer(ClassOutlineImpl outline, CPropertyInfo prop) {

        if (prop instanceof CReferencePropertyInfo) {
            CReferencePropertyInfo p = (CReferencePropertyInfo)prop;
            if (p.isDummy()) {
                return frf.getDummyList(outline.parent().getCodeModel().ref(ArrayList.class));
            }
            if (p.isContent() && (p.isMixedExtendedCust())) {
                return frf.getContentList(outline.parent().getCodeModel().ref(ArrayList.class).narrow(Serializable.class));
            }
        }

        if(!prop.isCollection()) {
            // non-collection field

            // TODO: check for bidning info for optionalPrimitiveType=boxed or
            // noHasMethod=false and noDeletedMethod=false
            if(prop.isUnboxable())
                // this one uses a primitive type as much as possible
                return frf.getRequiredUnboxed();
            else
                // otherwise use the default non-collection field
                return frf.getSingle();
        }

        if( defaultCollectionFieldRenderer==null ) {
            return frf.getList(outline.parent().getCodeModel().ref(ArrayList.class));
        }

        // this field is a collection field.
        // use untyped list as the default. This is consistent
        // to the JAXB spec.
        return defaultCollectionFieldRenderer;
    }