/** * Initialize the context. The encodingStyleURI allows .aegis.xml files to have multiple mappings for, * say, SOAP 1.1 versus SOAP 1.2. Passing null uses a default URI. * * @param mappingNamespaceURI URI to select mappings based on the encoding. */ public void initialize() { // allow spring config of an alternative mapping. if (configuration == null) { configuration = new TypeCreationOptions(); } if (typeMapping == null) { boolean defaultNillable = configuration.isDefaultNillable(); TypeMapping baseTM = DefaultTypeMapping.createDefaultTypeMapping(defaultNillable, mtomUseXmime, enableJDOMMappings); if (mappingNamespaceURI == null) { mappingNamespaceURI = DefaultTypeMapping.DEFAULT_MAPPING_URI; } DefaultTypeMapping defaultTypeMapping = new DefaultTypeMapping(mappingNamespaceURI, baseTM); defaultTypeMapping.setTypeCreator(createTypeCreator()); typeMapping = defaultTypeMapping; } processRootTypes(); }
public AnnotatedTypeInfo(TypeMapping tm, Class<?> typeClass, String ns, AnnotationReader annotationReader, TypeCreationOptions typeCreationOptions) { super(typeClass, ns); this.annotationReader = annotationReader; setQualifyAttributes(typeCreationOptions.isQualifyAttributes()); setQualifyElements(typeCreationOptions.isQualifyElements()); setTypeMapping(tm); initialize(); }
btinfo.setDefaultMinOccurs(getConfiguration().getDefaultMinOccurs()); btinfo.setDefaultNillable(getConfiguration().isDefaultNillable()); btinfo.setExtensibleElements(getConfiguration().isDefaultExtensibleElements()); btinfo.setExtensibleAttributes(Boolean.valueOf(extensibleAttributes).booleanValue()); } else { btinfo.setExtensibleAttributes(getConfiguration().isDefaultExtensibleAttributes()); btinfo.setQualifyAttributes(this.getConfiguration().isQualifyAttributes()); btinfo.setQualifyElements(this.getConfiguration().isQualifyElements()); BeanType type = new BeanType(btinfo);
@Override public AegisType createDefaultType(TypeClassInfo info) { QName typeName = info.getTypeName(); Class<?> relatedClass = TypeUtil.getTypeRelatedClass(info.getType()); if (typeName == null) { typeName = createQName(relatedClass); } AnnotatedTypeInfo typeInfo = new AnnotatedTypeInfo( getTypeMapping(), relatedClass, typeName.getNamespaceURI(), getConfiguration()); typeInfo.setExtensibleElements(annotationReader.isExtensibleElements( relatedClass, getConfiguration().isDefaultExtensibleElements())); typeInfo.setExtensibleAttributes(annotationReader.isExtensibleAttributes( relatedClass, getConfiguration().isDefaultExtensibleAttributes())); typeInfo.setDefaultMinOccurs(getConfiguration().getDefaultMinOccurs()); typeInfo.setDefaultNillable(getConfiguration().isDefaultNillable()); BeanType type = new BeanType(typeInfo); type.setTypeMapping(getTypeMapping()); type.setSchemaType(typeName); return type; }
@Override public AegisType createDefaultType(TypeClassInfo info) { BeanType type = new BeanType(); /* * As of this point, we refuse to do this for generics in general. * This might be revisited ... it might turn out to 'just work'. */ Class<?> typeClass = TypeUtil.getTypeClass(info.getType(), false); if (typeClass == null) { throw new DatabindingException("Unable to map generic type " + info.getType()); } type.setSchemaType(createQName(typeClass)); type.setTypeClass(typeClass); type.setTypeMapping(getTypeMapping()); BeanTypeInfo typeInfo = type.getTypeInfo(); typeInfo.setDefaultMinOccurs(getConfiguration().getDefaultMinOccurs()); typeInfo.setExtensibleAttributes(getConfiguration().isDefaultExtensibleAttributes()); typeInfo.setExtensibleElements(getConfiguration().isDefaultExtensibleElements()); return type; } protected AegisType getOrCreateMapKeyType(TypeClassInfo info) {
protected AegisType createArrayType(TypeClassInfo info) { ArrayType type = new ArrayType(); type.setTypeMapping(getTypeMapping()); type.setTypeClass(info.getType()); type.setSchemaType(createCollectionQName(info, type.getComponentType())); if (info.getMinOccurs() != -1) { type.setMinOccurs(info.getMinOccurs()); } else { type.setMinOccurs(typeConfiguration.getDefaultMinOccurs()); } if (info.getMaxOccurs() != -1) { type.setMaxOccurs(info.getMaxOccurs()); } type.setFlat(info.isFlat()); return type; }
&& !getConfiguration().isDefaultNillable()) { result.setNillable(false);
btinfo.setDefaultMinOccurs(getConfiguration().getDefaultMinOccurs()); btinfo.setDefaultNillable(getConfiguration().isDefaultNillable()); btinfo.setExtensibleElements(getConfiguration().isDefaultExtensibleElements()); btinfo.setExtensibleAttributes(Boolean.valueOf(extensibleAttributes).booleanValue()); } else { btinfo.setExtensibleAttributes(getConfiguration().isDefaultExtensibleAttributes()); btinfo.setQualifyAttributes(this.getConfiguration().isQualifyAttributes()); btinfo.setQualifyElements(this.getConfiguration().isQualifyElements()); BeanType type = new BeanType(btinfo);
@Override public AegisType createDefaultType(TypeClassInfo info) { QName typeName = info.getTypeName(); Class<?> relatedClass = TypeUtil.getTypeRelatedClass(info.getType()); if (typeName == null) { typeName = createQName(relatedClass); } AnnotatedTypeInfo typeInfo = new AnnotatedTypeInfo( getTypeMapping(), relatedClass, typeName.getNamespaceURI(), getConfiguration()); typeInfo.setExtensibleElements(annotationReader.isExtensibleElements( relatedClass, getConfiguration().isDefaultExtensibleElements())); typeInfo.setExtensibleAttributes(annotationReader.isExtensibleAttributes( relatedClass, getConfiguration().isDefaultExtensibleAttributes())); typeInfo.setDefaultMinOccurs(getConfiguration().getDefaultMinOccurs()); typeInfo.setDefaultNillable(getConfiguration().isDefaultNillable()); BeanType type = new BeanType(typeInfo); type.setTypeMapping(getTypeMapping()); type.setSchemaType(typeName); return type; }
@Override public AegisType createDefaultType(TypeClassInfo info) { BeanType type = new BeanType(); /* * As of this point, we refuse to do this for generics in general. * This might be revisited ... it might turn out to 'just work'. */ Class<?> typeClass = TypeUtil.getTypeClass(info.getType(), false); if (typeClass == null) { throw new DatabindingException("Unable to map generic type " + info.getType()); } type.setSchemaType(createQName(typeClass)); type.setTypeClass(typeClass); type.setTypeMapping(getTypeMapping()); BeanTypeInfo typeInfo = type.getTypeInfo(); typeInfo.setDefaultMinOccurs(getConfiguration().getDefaultMinOccurs()); typeInfo.setExtensibleAttributes(getConfiguration().isDefaultExtensibleAttributes()); typeInfo.setExtensibleElements(getConfiguration().isDefaultExtensibleElements()); return type; } protected AegisType getOrCreateMapKeyType(TypeClassInfo info) {
protected AegisType createArrayType(TypeClassInfo info) { ArrayType type = new ArrayType(); type.setTypeMapping(getTypeMapping()); type.setTypeClass(info.getType()); type.setSchemaType(createCollectionQName(info, type.getComponentType())); if (info.getMinOccurs() != -1) { type.setMinOccurs(info.getMinOccurs()); } else { type.setMinOccurs(typeConfiguration.getDefaultMinOccurs()); } if (info.getMaxOccurs() != -1) { type.setMaxOccurs(info.getMaxOccurs()); } type.setFlat(info.isFlat()); return type; }
&& !getConfiguration().isDefaultNillable()) { result.setNillable(false);
public AnnotatedTypeInfo(TypeMapping tm, Class<?> typeClass, String ns, AnnotationReader annotationReader, TypeCreationOptions typeCreationOptions) { super(typeClass, ns); this.annotationReader = annotationReader; setQualifyAttributes(typeCreationOptions.isQualifyAttributes()); setQualifyElements(typeCreationOptions.isQualifyElements()); setTypeMapping(tm); initialize(); }
/** * Initialize the context. The encodingStyleURI allows .aegis.xml files to have multiple mappings for, * say, SOAP 1.1 versus SOAP 1.2. Passing null uses a default URI. * * @param mappingNamespaceURI URI to select mappings based on the encoding. */ public void initialize() { // allow spring config of an alternative mapping. if (configuration == null) { configuration = new TypeCreationOptions(); } if (typeMapping == null) { boolean defaultNillable = configuration.isDefaultNillable(); TypeMapping baseTM = DefaultTypeMapping.createDefaultTypeMapping(defaultNillable, mtomUseXmime, enableJDOMMappings); if (mappingNamespaceURI == null) { mappingNamespaceURI = DefaultTypeMapping.DEFAULT_MAPPING_URI; } DefaultTypeMapping defaultTypeMapping = new DefaultTypeMapping(mappingNamespaceURI, baseTM); defaultTypeMapping.setTypeCreator(createTypeCreator()); typeMapping = defaultTypeMapping; } processRootTypes(); }