Refine search
public CPropertyInfo onElement( CElementPropertyInfo propertyInfo) { final CElementPropertyInfo elementPropertyInfo = new CElementPropertyInfo( propertyInfo.getName(true), propertyInfo.isCollection() ? CollectionMode.REPEATED_ELEMENT : CollectionMode.NOT_REPEATED, propertyInfo.id(), propertyInfo .getExpectedMimeType(), propertyInfo.getSchemaComponent(), new CCustomizations(), (Locator) null, false); elementPropertyInfo.getTypes().addAll( context.getGetTypes().getTypes(context, propertyInfo)); return elementPropertyInfo; }
public final List<Property> calcDrilldown() { CElementPropertyInfo p = clazz.getProperty(); if(p.getAdapter()!=null) return null; // if adapted, avoid drill down if(p.isCollection()) // things like <xs:element name="foo" type="xs:NMTOKENS" /> is not eligible. return null; CTypeInfo typeClass = p.ref().get(0); if(!(typeClass instanceof CClassInfo)) // things like <xs:element name="foo" type="xs:string" /> is not eligible. return null; CClassInfo ci = (CClassInfo)typeClass; // if the type is abstract we can't use it. if(ci.isAbstract()) return null; // the 'all' compositor doesn't qualify if(!ci.isOrdered()) return null; return buildDrilldown(ci); } }
public CollectionMode onElement(CElementPropertyInfo p) { return p.isCollection() ? (p.isValueList() ? CollectionMode.REPEATED_VALUE : CollectionMode.REPEATED_ELEMENT) : CollectionMode.NOT_REPEATED; }
@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(); }
final String propertyName = wrappedPropertyInfo.getName(true); final CClassInfo classInfo = (CClassInfo) wrappedPropertyInfo.parent(); : classInfo.parent(); final CElementPropertyInfo itemPropertyInfo = new CElementPropertyInfo( "Item", CollectionMode.NOT_REPEATED, wrappedPropertyInfo.id(), wrappedPropertyInfo.getExpectedMimeType(), wrappedPropertyInfo.getSchemaComponent(), new CCustomizations( CustomizationUtils .getCustomizations(wrappedPropertyInfo)), wrappedPropertyInfo.getLocator(), wrappedPropertyInfo.isRequired()); itemPropertyInfo.getTypes().addAll(context.getGetTypes().getTypes(context, wrappedPropertyInfo)); itemClassInfo.addProperty(itemPropertyInfo); new CElementPropertyInfo( wrappedPropertyInfo.getExpectedMimeType(), null, wrappingPropertyCustomizations, null, false); wrappingPropertyInfo.getTypes().add( new CTypeRef(itemClassInfo, wrappingPropertyQName, null, false, null));
final CClassInfo classInfo = (CClassInfo) wrappedPropertyInfo.parent(); final String propertyName = wrappedPropertyInfo.getName(true); : classInfo.parent(); final CElementPropertyInfo itemPropertyInfo = new CElementPropertyInfo( "Item", CollectionMode.NOT_REPEATED, ID.NONE, wrappedPropertyInfo.getExpectedMimeType(), wrappedPropertyInfo .getSchemaComponent(), new CCustomizations( CustomizationUtils .getCustomizations(wrappedPropertyInfo)), wrappedPropertyInfo.getLocator(), false); itemPropertyInfo.getTypes().addAll( context.getGetTypes().getTypes(context, wrappedPropertyInfo) ); if (wrappedPropertyInfo.getAdapter() != null) { itemPropertyInfo.setAdapter(wrappedPropertyInfo.getAdapter()); new CElementPropertyInfo(propertyName + "Items", CollectionMode.REPEATED_ELEMENT, ID.NONE, wrappedPropertyInfo .getExpectedMimeType(), null, new CCustomizations(), null, false); wrappingPropertyInfo.getTypes().add( new CTypeRef(itemClassInfo, new QName(typeRef.getTagName() .getNamespaceURI(), typeRef.getTagName()
List<Property> result; CClassInfo bc = typeBean.getBaseClass(); if(bc!=null) { result = buildDrilldown(bc); result = new ArrayList<Property>(); for( CPropertyInfo p : typeBean.getProperties() ) { if (p instanceof CElementPropertyInfo) { CElementPropertyInfo ep = (CElementPropertyInfo) p; List<? extends CTypeRef> ref = ep.getTypes(); if(ref.size()!=1)
final CElementPropertyInfo itemPropertyInfo = new CElementPropertyInfo( propertyInfo.getName(true) + ((CClassInfo) propertyInfo.parent()).model .getNameConverter().toPropertyName( type.getTagName().getLocalPart()), CollectionMode.NOT_REPEATED, ID.NONE, propertyInfo .getExpectedMimeType(), propertyInfo .getSchemaComponent(), new CCustomizations(CustomizationUtils .getCustomizations(propertyInfo)), propertyInfo .getLocator(), false); itemPropertyInfo.getTypes().add(type);
public CPropertyInfo createElementPropertyInfo(String propertyName, XSComponent source, TypeUse propertyType, QName propertyQName, CollectionMode collectionMode, CCustomizations customizations) { final CNonElement propertyTypeInfo = propertyType.getInfo(); final CElementPropertyInfo propertyInfo = new CElementPropertyInfo( propertyName, collectionMode, propertyTypeInfo.idUse(), propertyTypeInfo.getExpectedMimeType(), source, customizations, null, true); final CTypeRef typeRef = new CTypeRef(propertyTypeInfo, propertyQName, propertyTypeInfo.getTypeName(), false, null); propertyInfo.setAdapter(propertyType.getAdapterUse()); propertyInfo.getTypes().add(typeRef); return propertyInfo; }
if(parent().target.getTypeName()==null) enclosingTypeNS = parent()._package().getMostUsedNamespaceURI(); else enclosingTypeNS = parent().target.getTypeName().getNamespaceURI(); if(ep.isRequired() && exposedType.isReference()) { if(xew == null) xew = getXew(checkWrapper, field); xew.required(true); if(ep.isRequired() && !prop.isCollection()) jtype = jtype.unboxify();
public NType getContentInMemoryType() { if(getProperty().getAdapter()==null) { NType itemType = getContentType().getType(); if(!property.isCollection()) return itemType; return NavigatorImpl.createParameterizedType(List.class,itemType); } else { return getProperty().getAdapter().customType; } }
/** * Annotate the element property 'field' */ private void annotateElement(JAnnotatable field) { CElementPropertyInfo ep = (CElementPropertyInfo) prop; List<CTypeRef> types = ep.getTypes(); if(ep.isValueList()) { field.annotate(XmlList.class); } assert ep.getXmlName()==null; // if( eName!=null ) { // wrapper // XmlElementWrapperWriter xcw = field.annotate2(XmlElementWrapperWriter.class); // xcw.name(eName.getLocalPart()) // .namespace(eName.getNamespaceURI()); // } if (types.size() == 1) { CTypeRef t = types.get(0); writeXmlElementAnnotation(field, t, resolve(t,IMPLEMENTATION), false); } else { for (CTypeRef t : types) { // generate @XmlElements writeXmlElementAnnotation(field, t, resolve(t,IMPLEMENTATION), true); } xesw = null; } }
private Void onRepeated(DPattern p,boolean optional) { RawTypeSet rts = RawTypeSetBuilder.build(compiler, p, optional? Multiplicity.STAR : Multiplicity.PLUS); if(rts.canBeTypeRefs==RawTypeSet.Mode.SHOULD_BE_TYPEREF) { CElementPropertyInfo prop = new CElementPropertyInfo( calcName(p),REPEATED_ELEMENT,ID.NONE,null,null,null,p.getLocation(),!optional); rts.addTo(prop); clazz.addProperty(prop); } else { CReferencePropertyInfo prop = new CReferencePropertyInfo( calcName(p),true,!optional,false/*TODO*/,null,null,p.getLocation(), false, false, false); rts.addTo(prop); clazz.addProperty(prop); } return null; }
protected RawTypeSet.Mode canBeType(RawTypeSet parent) { // if element substitution can occur, no way it can be mapped to a list of types if(decl.getSubstitutables().size()>1) return RawTypeSet.Mode.MUST_BE_REFERENCE; // BIXSubstitutable also simulates this effect. Useful for separate compilation BIXSubstitutable subst = builder.getBindInfo(decl).get(BIXSubstitutable.class); if(subst!=null) { subst.markAsAcknowledged(); return RawTypeSet.Mode.MUST_BE_REFERENCE; } // we have no place to put an adater if this thing maps to a type CElementPropertyInfo p = target.getProperty(); // if we have an adapter or IDness, which requires special // annotation, and there's more than one element, // we have no place to put the special annotation, so we need JAXBElement. if((parent.refs.size()>1 || !parent.mul.isAtMostOnce()) && p.id()!=ID.NONE) return RawTypeSet.Mode.MUST_BE_REFERENCE; if(parent.refs.size() > 1 && p.getAdapter() != null) return RawTypeSet.Mode.MUST_BE_REFERENCE; if(target.hasClass()) // if the CElementInfo was explicitly bound to a class (which happen if and only if // the user requested so, then map that to reference property so that the user sees a class return RawTypeSet.Mode.CAN_BE_TYPEREF; else return RawTypeSet.Mode.SHOULD_BE_TYPEREF; }
return _info.isRequired();
protected CTypeRef toTypeRef(CElementPropertyInfo ep) { assert !target.isCollection(); CAdapter a = target.getProperty().getAdapter(); if(a!=null && ep!=null) ep.setAdapter(a); return new CTypeRef(target.getContentType(),decl); }
public Void onElement(CElementPropertyInfo p) { for (CTypeRef tr : p.getTypes()) { countURI(propUriCountMap, tr.getTagName()); } return null; }
/** * Annotate the element property 'field' */ private void annotateElement(JAnnotatable field) { CElementPropertyInfo ep = (CElementPropertyInfo) prop; List<CTypeRef> types = ep.getTypes(); if(ep.isValueList()) { field.annotate(XmlList.class); } // if( eName!=null ) { // wrapper // XmlElementWrapperWriter xcw = field.annotate2(XmlElementWrapperWriter.class); // xcw.name(eName.getLocalPart()) // .namespace(eName.getNamespaceURI()); // } if (types.size() == 1) { CTypeRef t = types.get(0); writeXmlElementAnnotation(field, t, resolve(t,IMPLEMENTATION), false); } else { for (CTypeRef t : types) { // generate @XmlElements writeXmlElementAnnotation(field, t, resolve(t,IMPLEMENTATION), true); } xesw = null; } }
XSComponent schemaComponent = property.getSchemaComponent(); ParticleImpl particle = (ParticleImpl) schemaComponent; boolean required = property.isRequired(); if (minOccurs < 0 || minOccurs >= 1 && required && !nillable) { if (!hasAnnotation(field, NotNull.class)) {
protected JClass getDeclaredType() { final CElementPropertyInfo property = getElementInfo().getProperty(); if (property.getAdapter() == null) { @SuppressWarnings("unused") final CNonElement type = property.ref().iterator().next(); final JClass declaredType = (JClass) getType().toType( outline.parent(), Aspect.EXPOSED); return declaredType; } else { return (JClass) property.getAdapter().customType.toType(outline.parent(), Aspect.EXPOSED); } }