use of com.sun.tools.xjc.reader.gbind.Element in project jaxb-ri by eclipse-ee4j.
the class ExpressionParticleBinder method buildProperty.
/**
* Builds a property ouf ot a connected component.
*/
private void buildProperty(ConnectedComponent cc) {
// property name
StringBuilder propName = new StringBuilder();
// combine only up to 3
int nameTokenCount = 0;
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;
}
// no other kind should be here
assert false : e;
}
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);
}
Aggregations