@Override public QName collectElementNames(Map<QName, CPropertyInfo> table) { for (CTypeRef t : types) { QName n = t.getTagName(); if(table.containsKey(n)) return n; table.put(n, this); } return null; } }
public QName getSchemaType() { if(types.size()!=1) // if more than one kind is here, can't produce @XmlSchemaType. // TODO: is it allowed to have one generated if types return null; CTypeRef t = types.get(0); if(needsExplicitTypeName(t.getTarget(),t.typeName)) return t.typeName; else return null; }
protected CTypeRef toTypeRef(CElementPropertyInfo ep) { return new CTypeRef(target,decl); }
String generatedName = ctype.getTagName().getLocalPart(); if(!generatedName.equals(propName)) { if(xew == null) xew = getXew(checkWrapper, field); String generatedNS = ctype.getTagName().getNamespaceURI(); if (((formDefault == XmlNsForm.QUALIFIED) && !generatedNS.equals(enclosingTypeNS)) || ((formDefault == XmlNsForm.UNQUALIFIED) && !generatedNS.equals(""))) { final String defaultValue = ctype.getDefaultValue(); if (defaultValue!=null) { if(xew == null) xew = getXew(checkWrapper, field); if (ctype.isNillable()) { if(xew == null) xew = getXew(checkWrapper, field); xew.nillable(true);
public void initContentType(TypeUse contentType, @Nullable XSElementDecl source, XmlString defaultValue) { assert this.property==null; // must not be called twice this.property = new CElementPropertyInfo("Value", contentType.isCollection()?REPEATED_VALUE:NOT_REPEATED, contentType.idUse(), contentType.getExpectedMimeType(), source,null,getLocator(),true); this.property.setAdapter(contentType.getAdapterUse()); BIInlineBinaryData.handle(source,property); property.getTypes().add(new CTypeRef(contentType.getInfo(),tagName,CTypeRef.getSimpleTypeName(source), true,defaultValue)); this.type = NavigatorImpl.createParameterizedType( NavigatorImpl.theInstance.ref(JAXBElement.class), getContentInMemoryType() ); BIFactoryMethod factoryMethod = Ring.get(BGMBuilder.class).getBindInfo(source).get(BIFactoryMethod.class); if(factoryMethod!=null) { factoryMethod.markAsAcknowledged(); this.squeezedName = factoryMethod.name; } }
public boolean isUnboxable() { if(!isCollection() && !required) // if the property can be legally absent, it's not unboxable return false; // we need to have null to represent the absence of value. not unboxable. for (CTypeRef t : getTypes()) { if(t.isNillable()) return false; } return super.isUnboxable(); }
public final String getDefaultValue() { return getProperty().getTypes().get(0).getDefaultValue(); }
public CTypeRef(CNonElement type, XSElementDecl decl) { this(type, BGMBuilder.getName(decl),getSimpleTypeName(decl), decl.isNillable(), decl.getDefaultValue() ); }
/** Returns raw schema name for simpleType property. May return null for other types. */ public final QName rawName() { if (fr instanceof ElementAdapter) { CElementInfo eInfo = ((ElementAdapter)fr).ei; if ((eInfo != null) && (eInfo.getProperty() != null)) { return eInfo.getProperty().getTypes().get(0).getTypeName(); } } return null; }
/** * Recursively search for type name. * * This is needed to find correct type for refs like: * *<xs:simpleType name="parent"> * <xs:restriction base="xs:date"/> *</xs:simpleType> *<xs:simpleType name="child"> * <xs:restriction base="parent"/> *</xs:simpleType> * *<xs:element name="testField" type="child"/> * * @param declType given type * @return simpleTypeName or null */ private static QName resolveSimpleTypeName(XSType declType) { QName name = BGMBuilder.getName(declType); QName result = null; if (name != null && !XMLConstants.W3C_XML_SCHEMA_NS_URI.equals(name.getNamespaceURI())) { result = resolveSimpleTypeName(declType.getBaseType()); } else { if ( !"anySimpleType".equals(declType.getName()) ) { result = name; } } return result; }
String generatedName = ctype.getTagName().getLocalPart(); if(!generatedName.equals(propName)) { if(xew == null) xew = getXew(checkWrapper, field); String generatedNS = ctype.getTagName().getNamespaceURI(); if (((formDefault == XmlNsForm.QUALIFIED) && !generatedNS.equals(enclosingTypeNS)) || ((formDefault == XmlNsForm.UNQUALIFIED) && !generatedNS.equals(""))) { final String defaultValue = ctype.getDefaultValue(); if (defaultValue!=null) { if(xew == null) xew = getXew(checkWrapper, field); if (ctype.isNillable()) { if(xew == null) xew = getXew(checkWrapper, field); xew.nillable(true);
public void initContentType(TypeUse contentType, @Nullable XSElementDecl source, XmlString defaultValue) { assert this.property==null; // must not be called twice this.property = new CElementPropertyInfo("Value", contentType.isCollection()?REPEATED_VALUE:NOT_REPEATED, contentType.idUse(), contentType.getExpectedMimeType(), source,null,getLocator(),true); this.property.setAdapter(contentType.getAdapterUse()); BIInlineBinaryData.handle(source,property); property.getTypes().add(new CTypeRef(contentType.getInfo(),tagName,CTypeRef.getSimpleTypeName(source), true,defaultValue)); this.type = NavigatorImpl.createParameterizedType( NavigatorImpl.theInstance.ref(JAXBElement.class), getContentInMemoryType() ); BIFactoryMethod factoryMethod = Ring.get(BGMBuilder.class).getBindInfo(source).get(BIFactoryMethod.class); if(factoryMethod!=null) { factoryMethod.markAsAcknowledged(); this.squeezedName = factoryMethod.name; } }
@Override public boolean isOptionalPrimitive() { // we need to have null to represent the absence of value. not unboxable. for (CTypeRef t : getTypes()) { if(t.isNillable()) return false; } return !isCollection() && !required && super.isUnboxable(); }
public final String getDefaultValue() { return getProperty().getTypes().get(0).getDefaultValue(); }
public CTypeRef(CNonElement type, XSElementDecl decl) { this(type, BGMBuilder.getName(decl),getSimpleTypeName(decl), decl.isNillable(), decl.getDefaultValue() ); }
/** Returns raw schema name for simpleType property. May return null for other types. */ public final QName rawName() { if (fr instanceof ElementAdapter) { CElementInfo eInfo = ((ElementAdapter)fr).ei; if ((eInfo != null) && (eInfo.getProperty() != null)) { return eInfo.getProperty().getTypes().get(0).getTypeName(); } } return null; }
/** * Recursively search for type name. * * This is needed to find correct type for refs like: * *<xs:simpleType name="parent"> * <xs:restriction base="xs:date"/> *</xs:simpleType> *<xs:simpleType name="child"> * <xs:restriction base="parent"/> *</xs:simpleType> * *<xs:element name="testField" type="child"/> * * @param declType given type * @return simpleTypeName or null */ private static QName resolveSimpleTypeName(XSType declType) { QName name = BGMBuilder.getName(declType); QName result = null; if (name != null && !XMLConstants.W3C_XML_SCHEMA_NS_URI.equals(name.getNamespaceURI())) { result = resolveSimpleTypeName(declType.getBaseType()); } else { if ( !"anySimpleType".equals(declType.getName()) ) { result = name; } } return result; }
String generatedName = ctype.getTagName().getLocalPart(); if(!generatedName.equals(propName)) { if(xew == null) xew = getXew(checkWrapper, field); String generatedNS = ctype.getTagName().getNamespaceURI(); if (((formDefault == XmlNsForm.QUALIFIED) && !generatedNS.equals(mostUsedURI)) || ((formDefault == XmlNsForm.UNQUALIFIED) && !generatedNS.equals(""))) { final String defaultValue = ctype.getDefaultValue(); if (defaultValue!=null) { if(xew == null) xew = getXew(checkWrapper, field); if (ctype.isNillable()) { if(xew == null) xew = getXew(checkWrapper, field); xew.nillable(true);
@Override public QName collectElementNames(Map<QName, CPropertyInfo> table) { for (CTypeRef t : types) { QName n = t.getTagName(); if(table.containsKey(n)) return n; table.put(n, this); } return null; } }
public QName getSchemaType() { if(types.size()!=1) // if more than one kind is here, can't produce @XmlSchemaType. // TODO: is it allowed to have one generated if types return null; CTypeRef t = types.get(0); if(needsExplicitTypeName(t.getTarget(),t.typeName)) return t.typeName; else return null; }