com.sun.tools.internal.xjc.reader.gbind.ConnectedComponent Java Examples

The following examples show how to use com.sun.tools.internal.xjc.reader.gbind.ConnectedComponent. 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: ExpressionParticleBinder.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Finds a {@link XSParticle} that can serve as the representative property of
 * the given {@link ConnectedComponent}.
 *
 * The representative property is used for reporting an error location and
 * taking {@link BIProperty} customization. Right now, the algorithm is just pick
 * the first one with {@link BIProperty}, but one can think of a better algorithm,
 * such as taking a choice of (A|B) if CC={A,B}.
 */
private XSParticle findSourceParticle(ConnectedComponent cc) {
    XSParticle first = null;

    for (Element e : cc) {
        GElement ge = (GElement)e;
        for (XSParticle p : ge.particles) {
            if(first==null)
                first = p;
            if(getLocalPropCustomization(p)!=null)
                return p;
        }
        // if there are multiple property customizations,
        // all but one will be left unused, which will be detected as an error
        // later, so no need to check that now.
    }

    // if no customization was found, just use the first one.
    return first;
}
 
Example #2
Source File: ExpressionParticleBinder.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Finds a {@link XSParticle} that can serve as the representative property of
 * the given {@link ConnectedComponent}.
 *
 * The representative property is used for reporting an error location and
 * taking {@link BIProperty} customization. Right now, the algorithm is just pick
 * the first one with {@link BIProperty}, but one can think of a better algorithm,
 * such as taking a choice of (A|B) if CC={A,B}.
 */
private XSParticle findSourceParticle(ConnectedComponent cc) {
    XSParticle first = null;

    for (Element e : cc) {
        GElement ge = (GElement)e;
        for (XSParticle p : ge.particles) {
            if(first==null)
                first = p;
            if(getLocalPropCustomization(p)!=null)
                return p;
        }
        // if there are multiple property customizations,
        // all but one will be left unused, which will be detected as an error
        // later, so no need to check that now.
    }

    // if no customization was found, just use the first one.
    return first;
}
 
Example #3
Source File: ExpressionParticleBinder.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Finds a {@link XSParticle} that can serve as the representative property of
 * the given {@link ConnectedComponent}.
 *
 * The representative property is used for reporting an error location and
 * taking {@link BIProperty} customization. Right now, the algorithm is just pick
 * the first one with {@link BIProperty}, but one can think of a better algorithm,
 * such as taking a choice of (A|B) if CC={A,B}.
 */
private XSParticle findSourceParticle(ConnectedComponent cc) {
    XSParticle first = null;

    for (Element e : cc) {
        GElement ge = (GElement)e;
        for (XSParticle p : ge.particles) {
            if(first==null)
                first = p;
            if(getLocalPropCustomization(p)!=null)
                return p;
        }
        // if there are multiple property customizations,
        // all but one will be left unused, which will be detected as an error
        // later, so no need to check that now.
    }

    // if no customization was found, just use the first one.
    return first;
}
 
Example #4
Source File: ExpressionParticleBinder.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Finds a {@link XSParticle} that can serve as the representative property of
 * the given {@link ConnectedComponent}.
 *
 * The representative property is used for reporting an error location and
 * taking {@link BIProperty} customization. Right now, the algorithm is just pick
 * the first one with {@link BIProperty}, but one can think of a better algorithm,
 * such as taking a choice of (A|B) if CC={A,B}.
 */
private XSParticle findSourceParticle(ConnectedComponent cc) {
    XSParticle first = null;

    for (Element e : cc) {
        GElement ge = (GElement)e;
        for (XSParticle p : ge.particles) {
            if(first==null)
                first = p;
            if(getLocalPropCustomization(p)!=null)
                return p;
        }
        // if there are multiple property customizations,
        // all but one will be left unused, which will be detected as an error
        // later, so no need to check that now.
    }

    // if no customization was found, just use the first one.
    return first;
}
 
Example #5
Source File: ExpressionParticleBinder.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Finds a {@link XSParticle} that can serve as the representative property of
 * the given {@link ConnectedComponent}.
 *
 * The representative property is used for reporting an error location and
 * taking {@link BIProperty} customization. Right now, the algorithm is just pick
 * the first one with {@link BIProperty}, but one can think of a better algorithm,
 * such as taking a choice of (A|B) if CC={A,B}.
 */
private XSParticle findSourceParticle(ConnectedComponent cc) {
    XSParticle first = null;

    for (Element e : cc) {
        GElement ge = (GElement)e;
        for (XSParticle p : ge.particles) {
            if(first==null)
                first = p;
            if(getLocalPropCustomization(p)!=null)
                return p;
        }
        // if there are multiple property customizations,
        // all but one will be left unused, which will be detected as an error
        // later, so no need to check that now.
    }

    // if no customization was found, just use the first one.
    return first;
}
 
Example #6
Source File: ExpressionParticleBinder.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Finds a {@link XSParticle} that can serve as the representative property of
 * the given {@link ConnectedComponent}.
 *
 * The representative property is used for reporting an error location and
 * taking {@link BIProperty} customization. Right now, the algorithm is just pick
 * the first one with {@link BIProperty}, but one can think of a better algorithm,
 * such as taking a choice of (A|B) if CC={A,B}.
 */
private XSParticle findSourceParticle(ConnectedComponent cc) {
    XSParticle first = null;

    for (Element e : cc) {
        GElement ge = (GElement)e;
        for (XSParticle p : ge.particles) {
            if(first==null)
                first = p;
            if(getLocalPropCustomization(p)!=null)
                return p;
        }
        // if there are multiple property customizations,
        // all but one will be left unused, which will be detected as an error
        // later, so no need to check that now.
    }

    // if no customization was found, just use the first one.
    return first;
}
 
Example #7
Source File: ExpressionParticleBinder.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Finds a {@link XSParticle} that can serve as the representative property of
 * the given {@link ConnectedComponent}.
 *
 * The representative property is used for reporting an error location and
 * taking {@link BIProperty} customization. Right now, the algorithm is just pick
 * the first one with {@link BIProperty}, but one can think of a better algorithm,
 * such as taking a choice of (A|B) if CC={A,B}.
 */
private XSParticle findSourceParticle(ConnectedComponent cc) {
    XSParticle first = null;

    for (Element e : cc) {
        GElement ge = (GElement)e;
        for (XSParticle p : ge.particles) {
            if(first==null)
                first = p;
            if(getLocalPropCustomization(p)!=null)
                return p;
        }
        // if there are multiple property customizations,
        // all but one will be left unused, which will be detected as an error
        // later, so no need to check that now.
    }

    // if no customization was found, just use the first one.
    return first;
}
 
Example #8
Source File: ExpressionParticleBinder.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Finds a {@link XSParticle} that can serve as the representative property of
 * the given {@link ConnectedComponent}.
 *
 * The representative property is used for reporting an error location and
 * taking {@link BIProperty} customization. Right now, the algorithm is just pick
 * the first one with {@link BIProperty}, but one can think of a better algorithm,
 * such as taking a choice of (A|B) if CC={A,B}.
 */
private XSParticle findSourceParticle(ConnectedComponent cc) {
    XSParticle first = null;

    for (Element e : cc) {
        GElement ge = (GElement)e;
        for (XSParticle p : ge.particles) {
            if(first==null)
                first = p;
            if(getLocalPropCustomization(p)!=null)
                return p;
        }
        // if there are multiple property customizations,
        // all but one will be left unused, which will be detected as an error
        // later, so no need to check that now.
    }

    // if no customization was found, just use the first one.
    return first;
}
 
Example #9
Source File: ExpressionParticleBinder.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
public void build(XSParticle p, Collection<XSParticle> forcedProps) {
    // this class isn't about spec conformance, but
    // for the ease of use.
    // so we don't give a damn about 'forcedProps'.
    // although, for a future note, it's conceivable to expand
    // the binding algorithm to cover this notion.

    Expression tree = ExpressionBuilder.createTree(p);
    Graph g = new Graph(tree);
    for (ConnectedComponent cc : g) {
        buildProperty(cc);
    }
}
 
Example #10
Source File: ExpressionParticleBinder.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
public void build(XSParticle p, Collection<XSParticle> forcedProps) {
    // this class isn't about spec conformance, but
    // for the ease of use.
    // so we don't give a damn about 'forcedProps'.
    // although, for a future note, it's conceivable to expand
    // the binding algorithm to cover this notion.

    Expression tree = ExpressionBuilder.createTree(p);
    Graph g = new Graph(tree);
    for (ConnectedComponent cc : g) {
        buildProperty(cc);
    }
}
 
Example #11
Source File: ExpressionParticleBinder.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
public void build(XSParticle p, Collection<XSParticle> forcedProps) {
    // this class isn't about spec conformance, but
    // for the ease of use.
    // so we don't give a damn about 'forcedProps'.
    // although, for a future note, it's conceivable to expand
    // the binding algorithm to cover this notion.

    Expression tree = ExpressionBuilder.createTree(p);
    Graph g = new Graph(tree);
    for (ConnectedComponent cc : g) {
        buildProperty(cc);
    }
}
 
Example #12
Source File: ExpressionParticleBinder.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
public void build(XSParticle p, Collection<XSParticle> forcedProps) {
    // this class isn't about spec conformance, but
    // for the ease of use.
    // so we don't give a damn about 'forcedProps'.
    // although, for a future note, it's conceivable to expand
    // the binding algorithm to cover this notion.

    Expression tree = ExpressionBuilder.createTree(p);
    Graph g = new Graph(tree);
    for (ConnectedComponent cc : g) {
        buildProperty(cc);
    }
}
 
Example #13
Source File: ExpressionParticleBinder.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
public void build(XSParticle p, Collection<XSParticle> forcedProps) {
    // this class isn't about spec conformance, but
    // for the ease of use.
    // so we don't give a damn about 'forcedProps'.
    // although, for a future note, it's conceivable to expand
    // the binding algorithm to cover this notion.

    Expression tree = ExpressionBuilder.createTree(p);
    Graph g = new Graph(tree);
    for (ConnectedComponent cc : g) {
        buildProperty(cc);
    }
}
 
Example #14
Source File: ExpressionParticleBinder.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
public void build(XSParticle p, Collection<XSParticle> forcedProps) {
    // this class isn't about spec conformance, but
    // for the ease of use.
    // so we don't give a damn about 'forcedProps'.
    // although, for a future note, it's conceivable to expand
    // the binding algorithm to cover this notion.

    Expression tree = ExpressionBuilder.createTree(p);
    Graph g = new Graph(tree);
    for (ConnectedComponent cc : g) {
        buildProperty(cc);
    }
}
 
Example #15
Source File: ExpressionParticleBinder.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
public void build(XSParticle p, Collection<XSParticle> forcedProps) {
    // this class isn't about spec conformance, but
    // for the ease of use.
    // so we don't give a damn about 'forcedProps'.
    // although, for a future note, it's conceivable to expand
    // the binding algorithm to cover this notion.

    Expression tree = ExpressionBuilder.createTree(p);
    Graph g = new Graph(tree);
    for (ConnectedComponent cc : g) {
        buildProperty(cc);
    }
}
 
Example #16
Source File: ExpressionParticleBinder.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
public void build(XSParticle p, Collection<XSParticle> forcedProps) {
    // this class isn't about spec conformance, but
    // for the ease of use.
    // so we don't give a damn about 'forcedProps'.
    // although, for a future note, it's conceivable to expand
    // the binding algorithm to cover this notion.

    Expression tree = ExpressionBuilder.createTree(p);
    Graph g = new Graph(tree);
    for (ConnectedComponent cc : g) {
        buildProperty(cc);
    }
}
 
Example #17
Source File: ExpressionParticleBinder.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Builds a property ouf ot a connected component.
 */
private void buildProperty(ConnectedComponent cc) {
    StringBuilder propName = new StringBuilder(); // property name
    int nameTokenCount = 0; // combine only up to 3

    RawTypeSetBuilder rtsb = new RawTypeSetBuilder();
    for (Element e : cc) {
        GElement ge = (GElement)e;

        if(nameTokenCount<3) {
            if(nameTokenCount!=0)
                propName.append("And");
            propName.append(makeJavaName(cc.isCollection(),ge.getPropertyNameSeed()));
            nameTokenCount++;
        }

        if(e instanceof GElementImpl) {
            GElementImpl ei = (GElementImpl) e;
            rtsb.elementDecl(ei.decl);
            continue;
        }
        if(e instanceof GWildcardElement) {
            GWildcardElement w = (GWildcardElement)e;
            rtsb.getRefs().add(new RawTypeSetBuilder.WildcardRef(
                w.isStrict() ? WildcardMode.STRICT : WildcardMode.SKIP));
            continue;
        }
        assert false : e;   // no other kind should be here
    }

    Multiplicity m = Multiplicity.ONE;
    if(cc.isCollection())
        m = m.makeRepeated();
    if(!cc.isRequired())
        m = m.makeOptional();

    RawTypeSet rts = new RawTypeSet(rtsb.getRefs(),m);

    XSParticle p = findSourceParticle(cc);

    BIProperty cust = BIProperty.getCustomization(p);
    CPropertyInfo prop = cust.createElementOrReferenceProperty(
        propName.toString(), false, p, rts );
    getCurrentBean().addProperty(prop);
}
 
Example #18
Source File: ExpressionParticleBinder.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Builds a property ouf ot a connected component.
 */
private void buildProperty(ConnectedComponent cc) {
    StringBuilder propName = new StringBuilder(); // property name
    int nameTokenCount = 0; // combine only up to 3

    RawTypeSetBuilder rtsb = new RawTypeSetBuilder();
    for (Element e : cc) {
        GElement ge = (GElement)e;

        if(nameTokenCount<3) {
            if(nameTokenCount!=0)
                propName.append("And");
            propName.append(makeJavaName(cc.isCollection(),ge.getPropertyNameSeed()));
            nameTokenCount++;
        }

        if(e instanceof GElementImpl) {
            GElementImpl ei = (GElementImpl) e;
            rtsb.elementDecl(ei.decl);
            continue;
        }
        if(e instanceof GWildcardElement) {
            GWildcardElement w = (GWildcardElement)e;
            rtsb.getRefs().add(new RawTypeSetBuilder.WildcardRef(
                w.isStrict() ? WildcardMode.STRICT : WildcardMode.SKIP));
            continue;
        }
        assert false : e;   // no other kind should be here
    }

    Multiplicity m = Multiplicity.ONE;
    if(cc.isCollection())
        m = m.makeRepeated();
    if(!cc.isRequired())
        m = m.makeOptional();

    RawTypeSet rts = new RawTypeSet(rtsb.getRefs(),m);

    XSParticle p = findSourceParticle(cc);

    BIProperty cust = BIProperty.getCustomization(p);
    CPropertyInfo prop = cust.createElementOrReferenceProperty(
        propName.toString(), false, p, rts );
    getCurrentBean().addProperty(prop);
}
 
Example #19
Source File: ExpressionParticleBinder.java    From hottub with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Builds a property ouf ot a connected component.
 */
private void buildProperty(ConnectedComponent cc) {
    StringBuilder propName = new StringBuilder(); // property name
    int nameTokenCount = 0; // combine only up to 3

    RawTypeSetBuilder rtsb = new RawTypeSetBuilder();
    for (Element e : cc) {
        GElement ge = (GElement)e;

        if(nameTokenCount<3) {
            if(nameTokenCount!=0)
                propName.append("And");
            propName.append(makeJavaName(cc.isCollection(),ge.getPropertyNameSeed()));
            nameTokenCount++;
        }

        if(e instanceof GElementImpl) {
            GElementImpl ei = (GElementImpl) e;
            rtsb.elementDecl(ei.decl);
            continue;
        }
        if(e instanceof GWildcardElement) {
            GWildcardElement w = (GWildcardElement)e;
            rtsb.getRefs().add(new RawTypeSetBuilder.WildcardRef(
                w.isStrict() ? WildcardMode.STRICT : WildcardMode.SKIP));
            continue;
        }
        assert false : e;   // no other kind should be here
    }

    Multiplicity m = Multiplicity.ONE;
    if(cc.isCollection())
        m = m.makeRepeated();
    if(!cc.isRequired())
        m = m.makeOptional();

    RawTypeSet rts = new RawTypeSet(rtsb.getRefs(),m);

    XSParticle p = findSourceParticle(cc);

    BIProperty cust = BIProperty.getCustomization(p);
    CPropertyInfo prop = cust.createElementOrReferenceProperty(
        propName.toString(), false, p, rts );
    getCurrentBean().addProperty(prop);
}
 
Example #20
Source File: ExpressionParticleBinder.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Builds a property ouf ot a connected component.
 */
private void buildProperty(ConnectedComponent cc) {
    StringBuilder propName = new StringBuilder(); // property name
    int nameTokenCount = 0; // combine only up to 3

    RawTypeSetBuilder rtsb = new RawTypeSetBuilder();
    for (Element e : cc) {
        GElement ge = (GElement)e;

        if(nameTokenCount<3) {
            if(nameTokenCount!=0)
                propName.append("And");
            propName.append(makeJavaName(cc.isCollection(),ge.getPropertyNameSeed()));
            nameTokenCount++;
        }

        if(e instanceof GElementImpl) {
            GElementImpl ei = (GElementImpl) e;
            rtsb.elementDecl(ei.decl);
            continue;
        }
        if(e instanceof GWildcardElement) {
            GWildcardElement w = (GWildcardElement)e;
            rtsb.getRefs().add(new RawTypeSetBuilder.WildcardRef(
                w.isStrict() ? WildcardMode.STRICT : WildcardMode.SKIP));
            continue;
        }
        assert false : e;   // no other kind should be here
    }

    Multiplicity m = Multiplicity.ONE;
    if(cc.isCollection())
        m = m.makeRepeated();
    if(!cc.isRequired())
        m = m.makeOptional();

    RawTypeSet rts = new RawTypeSet(rtsb.getRefs(),m);

    XSParticle p = findSourceParticle(cc);

    BIProperty cust = BIProperty.getCustomization(p);
    CPropertyInfo prop = cust.createElementOrReferenceProperty(
        propName.toString(), false, p, rts );
    getCurrentBean().addProperty(prop);
}
 
Example #21
Source File: ExpressionParticleBinder.java    From openjdk-8-source with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Builds a property ouf ot a connected component.
 */
private void buildProperty(ConnectedComponent cc) {
    StringBuilder propName = new StringBuilder(); // property name
    int nameTokenCount = 0; // combine only up to 3

    RawTypeSetBuilder rtsb = new RawTypeSetBuilder();
    for (Element e : cc) {
        GElement ge = (GElement)e;

        if(nameTokenCount<3) {
            if(nameTokenCount!=0)
                propName.append("And");
            propName.append(makeJavaName(cc.isCollection(),ge.getPropertyNameSeed()));
            nameTokenCount++;
        }

        if(e instanceof GElementImpl) {
            GElementImpl ei = (GElementImpl) e;
            rtsb.elementDecl(ei.decl);
            continue;
        }
        if(e instanceof GWildcardElement) {
            GWildcardElement w = (GWildcardElement)e;
            rtsb.getRefs().add(new RawTypeSetBuilder.WildcardRef(
                w.isStrict() ? WildcardMode.STRICT : WildcardMode.SKIP));
            continue;
        }
        assert false : e;   // no other kind should be here
    }

    Multiplicity m = Multiplicity.ONE;
    if(cc.isCollection())
        m = m.makeRepeated();
    if(!cc.isRequired())
        m = m.makeOptional();

    RawTypeSet rts = new RawTypeSet(rtsb.getRefs(),m);

    XSParticle p = findSourceParticle(cc);

    BIProperty cust = BIProperty.getCustomization(p);
    CPropertyInfo prop = cust.createElementOrReferenceProperty(
        propName.toString(), false, p, rts );
    getCurrentBean().addProperty(prop);
}
 
Example #22
Source File: ExpressionParticleBinder.java    From jdk8u60 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Builds a property ouf ot a connected component.
 */
private void buildProperty(ConnectedComponent cc) {
    StringBuilder propName = new StringBuilder(); // property name
    int nameTokenCount = 0; // combine only up to 3

    RawTypeSetBuilder rtsb = new RawTypeSetBuilder();
    for (Element e : cc) {
        GElement ge = (GElement)e;

        if(nameTokenCount<3) {
            if(nameTokenCount!=0)
                propName.append("And");
            propName.append(makeJavaName(cc.isCollection(),ge.getPropertyNameSeed()));
            nameTokenCount++;
        }

        if(e instanceof GElementImpl) {
            GElementImpl ei = (GElementImpl) e;
            rtsb.elementDecl(ei.decl);
            continue;
        }
        if(e instanceof GWildcardElement) {
            GWildcardElement w = (GWildcardElement)e;
            rtsb.getRefs().add(new RawTypeSetBuilder.WildcardRef(
                w.isStrict() ? WildcardMode.STRICT : WildcardMode.SKIP));
            continue;
        }
        assert false : e;   // no other kind should be here
    }

    Multiplicity m = Multiplicity.ONE;
    if(cc.isCollection())
        m = m.makeRepeated();
    if(!cc.isRequired())
        m = m.makeOptional();

    RawTypeSet rts = new RawTypeSet(rtsb.getRefs(),m);

    XSParticle p = findSourceParticle(cc);

    BIProperty cust = BIProperty.getCustomization(p);
    CPropertyInfo prop = cust.createElementOrReferenceProperty(
        propName.toString(), false, p, rts );
    getCurrentBean().addProperty(prop);
}
 
Example #23
Source File: ExpressionParticleBinder.java    From openjdk-8 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Builds a property ouf ot a connected component.
 */
private void buildProperty(ConnectedComponent cc) {
    StringBuilder propName = new StringBuilder(); // property name
    int nameTokenCount = 0; // combine only up to 3

    RawTypeSetBuilder rtsb = new RawTypeSetBuilder();
    for (Element e : cc) {
        GElement ge = (GElement)e;

        if(nameTokenCount<3) {
            if(nameTokenCount!=0)
                propName.append("And");
            propName.append(makeJavaName(cc.isCollection(),ge.getPropertyNameSeed()));
            nameTokenCount++;
        }

        if(e instanceof GElementImpl) {
            GElementImpl ei = (GElementImpl) e;
            rtsb.elementDecl(ei.decl);
            continue;
        }
        if(e instanceof GWildcardElement) {
            GWildcardElement w = (GWildcardElement)e;
            rtsb.getRefs().add(new RawTypeSetBuilder.WildcardRef(
                w.isStrict() ? WildcardMode.STRICT : WildcardMode.SKIP));
            continue;
        }
        assert false : e;   // no other kind should be here
    }

    Multiplicity m = Multiplicity.ONE;
    if(cc.isCollection())
        m = m.makeRepeated();
    if(!cc.isRequired())
        m = m.makeOptional();

    RawTypeSet rts = new RawTypeSet(rtsb.getRefs(),m);

    XSParticle p = findSourceParticle(cc);

    BIProperty cust = BIProperty.getCustomization(p);
    CPropertyInfo prop = cust.createElementOrReferenceProperty(
        propName.toString(), false, p, rts );
    getCurrentBean().addProperty(prop);
}
 
Example #24
Source File: ExpressionParticleBinder.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Builds a property ouf ot a connected component.
 */
private void buildProperty(ConnectedComponent cc) {
    StringBuilder propName = new StringBuilder(); // property name
    int nameTokenCount = 0; // combine only up to 3

    RawTypeSetBuilder rtsb = new RawTypeSetBuilder();
    for (Element e : cc) {
        GElement ge = (GElement)e;

        if(nameTokenCount<3) {
            if(nameTokenCount!=0)
                propName.append("And");
            propName.append(makeJavaName(cc.isCollection(),ge.getPropertyNameSeed()));
            nameTokenCount++;
        }

        if(e instanceof GElementImpl) {
            GElementImpl ei = (GElementImpl) e;
            rtsb.elementDecl(ei.decl);
            continue;
        }
        if(e instanceof GWildcardElement) {
            GWildcardElement w = (GWildcardElement)e;
            rtsb.getRefs().add(new RawTypeSetBuilder.WildcardRef(
                w.isStrict() ? WildcardMode.STRICT : WildcardMode.SKIP));
            continue;
        }
        assert false : e;   // no other kind should be here
    }

    Multiplicity m = Multiplicity.ONE;
    if(cc.isCollection())
        m = m.makeRepeated();
    if(!cc.isRequired())
        m = m.makeOptional();

    RawTypeSet rts = new RawTypeSet(rtsb.getRefs(),m);

    XSParticle p = findSourceParticle(cc);

    BIProperty cust = BIProperty.getCustomization(p);
    CPropertyInfo prop = cust.createElementOrReferenceProperty(
        propName.toString(), false, p, rts );
    getCurrentBean().addProperty(prop);
}