private Object parseDefaultValue(XSParticle elementParticle, QName typeName) { if (elementParticle == null) { return null; } XSTerm term = elementParticle.getTerm(); if (term == null) { return null; } XSElementDecl elementDecl = term.asElementDecl(); if (elementDecl == null) { return null; } if (elementDecl.getDefaultValue() != null) { if (XmlTypeConverter.canConvert(typeName)) { return XmlTypeConverter.toJavaValue(elementDecl.getDefaultValue().value, typeName); } return elementDecl.getDefaultValue().value; } return null; }
public CTypeRef(CNonElement type, XSElementDecl decl) { this(type, BGMBuilder.getName(decl),getSimpleTypeName(decl), decl.isNillable(), decl.getDefaultValue() ); }
public CTypeRef(CNonElement type, XSElementDecl decl) { this(type, BGMBuilder.getName(decl),getSimpleTypeName(decl), decl.isNillable(), decl.getDefaultValue() ); }
public CTypeRef(CNonElement type, XSElementDecl decl) { this(type, BGMBuilder.getName(decl),getSimpleTypeName(decl), decl.isNillable(), decl.getDefaultValue() ); }
public CTypeRef(CNonElement type, XSElementDecl decl) { this(type, BGMBuilder.getName(decl),getSimpleTypeName(decl), decl.isNillable(), decl.getDefaultValue() ); }
public CTypeRef(CNonElement type, XSElementDecl decl) { this(type, BGMBuilder.getName(decl),getSimpleTypeName(decl), decl.isNillable(), decl.getDefaultValue() ); }
protected static Field createField(ComplexType type, XSElementDecl element, Type fieldType) { String elementName = element.getName(); XmlString dv = element.getDefaultValue(); String defValue = null; if (dv != null) {
XmlString dv = element.getDefaultValue(); String defValue = null; if (dv != null) {
private String extractDefaultValue(XSComponent component) { XmlString defaultValue = null, fixedValue = null; // transform attribute use to declaration if (component instanceof XSAttributeUse) { XSAttributeUse attribute = (XSAttributeUse) component; component = attribute.getDecl(); } if (component instanceof XSAttributeDecl) { XSAttributeDecl attribute = (XSAttributeDecl) component; defaultValue = attribute.getDefaultValue(); fixedValue = attribute.getFixedValue(); } else if (component instanceof XSElementDecl) { XSElementDecl element = (XSElementDecl) component; defaultValue = element.getDefaultValue(); fixedValue = element.getFixedValue(); } if (defaultValue != null && fixedValue != null) { throw new SchemagenException( "schema elements should either contain a fixed or a default value, but not both" ); } else if (defaultValue != null) { return defaultValue.value; } else if (fixedValue != null) { return fixedValue.value; } else { return null; } }
/** * 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); } }
cei.initContentType( selector.bindToType(decl.getType(),decl), decl, decl.getDefaultValue() ); stb.refererStack.pop(); r = cei;
/** * 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); } }
/** * 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); } }
/** * 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); } }
/** * 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); } }
private boolean containsDefaultValue(Outline outline, FieldOutline field) { ClassOutline fClass = null; for (ClassOutline classOutline : outline.getClasses()) { if (classOutline.implClass == field.getRawType() && !classOutline.implClass.isAbstract()) { fClass = classOutline; break; } } if (fClass == null) { return false; } for (FieldOutline f : fClass.getDeclaredFields()) { if (f.getPropertyInfo().getSchemaComponent() instanceof XSParticle) { XSParticle particle = (XSParticle)f.getPropertyInfo().getSchemaComponent(); XSTerm term = particle.getTerm(); if (term.isElementDecl() && term.asElementDecl().getDefaultValue() != null) { return true; } } } return false; }
cei.initContentType( selector.bindToType(decl.getType(),decl), decl, decl.getDefaultValue() ); stb.refererStack.pop(); r = cei;
cei.initContentType( selector.bindToType(decl.getType(),decl), decl, decl.getDefaultValue() ); stb.refererStack.pop(); r = cei;
cei.initContentType( selector.bindToType(decl.getType(),decl), decl, decl.getDefaultValue() ); stb.refererStack.pop(); r = cei;
cei.initContentType( selector.bindToType(decl.getType(),decl), decl, decl.getDefaultValue() ); stb.refererStack.pop(); r = cei;