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
>