I tried something like this once in an effort to take control of namespace prefix selection. I failed. However, it looks here as if the protocol facilitates what you want here, unlike (sadly) what I wanted.
> -----Original Message----- > From: Dan Diephouse [mailto:[EMAIL PROTECTED] > Sent: Monday, August 27, 2007 1:23 PM > To: [email protected] > Subject: Re: Aegis binding and property/fiels removal > > Hi Guillaume > > This is a little bit tricky, but doable I think. > > Step 1: Write your own TypeCreator which initializes a MyBeanType with > your > own BeanTypeInfo. BeanTypeInfos provides metadata about how to map beans > to > xml. > > public class MyTypeCreator extends DefaultTypeCreator { > @Override > public Type createDefaultType(TypeClassInfo info) { > MyBeanType type = new MyBeanType(); > type.setSchemaType(createQName(info.getTypeClass())); > type.setTypeClass(info.getTypeClass()); > type.setTypeMapping(getTypeMapping()); > > BeanTypeInfo typeInfo = type.getTypeInfo(); > typeInfo.setDefaultMinOccurs > (getConfiguration().getDefaultMinOccurs()); > typeInfo.setExtensibleAttributes > (getConfiguration().isDefaultExtensibleAttributes()); > typeInfo.setExtensibleElements > (getConfiguration().isDefaultExtensibleElements()); > > return type; > } > } > Step 2: Write the MyBeanType class which creates a MyBeanTypeInfo: > > public class MyBeanType extends BeanType { > > public BeanTypeInfo createTypeInfo() { > MyBeanTypeInfo inf = new MyBeanTypeInfo(getTypeClass(), > getSchemaType().getNamespaceURI()); > > inf.setTypeMapping(getTypeMapping()); > > return inf; > } > } > > Step3: Write a MyBeanTypeInfo: > > public class MyBeanTypeInfo extends BeanTypeInfo { > ... write constructors > > protected boolean isElement(PropertyDescriptor desc) { > // add some custom logic to determine if you want this property to > be > mapped > return true; > } > } > > Step 4: Write your own type registry to return your own TypeCreator > > public class MyTypeMappingRegistry extends DefaultTypeMappingRegistry { > > protected AbstractTypeCreator createDefaultTypeCreator() { > AbstractTypeCreator creator = new MyTypeCreator(); > creator.setConfiguration(getConfiguration()); > return creator; > } > } > > Step 5: use it: > > ServerFactoryBean sfb = new ServerFactoryBean(); > > AegisDatabinding db = new AegisDataBinding(); > db.setTypeMappingRegistry(new MyTypeMappingRegistry()); > sfb.setDatabinding(db); > ... > > Hope that works for you! > > - Dan > > On 8/27/07, tog <[EMAIL PROTECTED]> wrote: > > > > Hiya > > > > I have some automatically generated classes that I use to generate a > > server > > using Aegis. This is done programmaticaly. I am using an > > AegisServiceConfiguration class to avoid publishing methods that I want > to > > remove. I would like similarly to remove some fields/properties from the > > serialization process. > > How is that possible (programmaticaly) ? > > > > Thanks for your help. > > > > Guillaume > >
