void build() {
if(!(this.bean instanceof CClassInfo))
return; // no need to "build"
CClassInfo bean = (CClassInfo)this.bean;
if(!built.add(bean))
return; // already built
for( String reservedClassName : reservedClassNames ) {
if( bean.getName().equals(reservedClassName) ) {
getErrorReporter().error( sc.getLocator(),
Messages.ERR_RESERVED_CLASS_NAME, reservedClassName );
break;
}
}
// if this schema component is an element declaration
// and it satisfies a set of conditions specified in the spec,
// this class will receive a constructor.
if(needValueConstructor(sc)) {
// TODO: fragile. There is no guarantee that the property name
// is in fact "value".
bean.addConstructor("value");
}
if(bean.javadoc==null)
addSchemaFragmentJavadoc(bean,sc);
// build the body
if(builder.getGlobalBinding().getFlattenClasses()==LocalScoping.NESTED)
pushClassScope(bean);
else
pushClassScope(bean.parent());
XSComponent oldRoot = currentRoot;
CClassInfo oldBean = currentBean;
currentRoot = sc;
currentBean = bean;
sc.visit(Ring.get(BindRed.class));
currentBean = oldBean;
currentRoot = oldRoot;