//-- create main group class
String fname = component.getJavaClassName() + ITEM_NAME;
fname = getJavaNaming().toJavaMemberName(fname, false);
FieldInfo fInfo = null;
if (createForSingleGroup) {
//By default a nested group Item can occur only once
fInfo = getInfoFactory().createFieldInfo(new XSClass(jClass), fname);
} else {
fInfo = getInfoFactory().createCollection(
new XSClass(jClass), "_items", fname, getJavaNaming(), getConfig().useJava50());
}
fInfo.setContainer(true);
String newClassName = className.substring(0, className.length() - 4);
state = new FactoryState(newClassName, sgState, packageName, component);
classInfo = state.getClassInfo();
jClass = state.getJClass();
initialize(jClass);
if (type != null && type.isComplexType()) {
ComplexType complexType = (ComplexType) type;
if (complexType.isTopLevel() ^ creatingForAnElement) {
//process attributes and content type since it has not be performed before
Annotated saved = component.getAnnotated();
processAttributes(component.getBinding(), complexType, state);
component.setView(saved);
if (complexType.getContentType() == ContentType.mixed) {
FieldInfo fieldInfo = _memberFactory.createFieldInfoForContent(
component, new XSString(), getConfig().useJava50());
handleField(fieldInfo, state, component);
} else if (complexType.getContentType().getType() == ContentType.SIMPLE) {
SimpleContent simpleContent = (SimpleContent) complexType.getContentType();
SimpleType temp = simpleContent.getSimpleType();
XSType xsType = _typeConversion.convertType(
temp, packageName, getConfig().useJava50());
FieldInfo fieldInfo = _memberFactory.createFieldInfoForContent(
component, xsType, getConfig().useJava50());
handleField(fieldInfo, state, component);
temp = null;
} else {
// handle multi-valued choice group