Re: How to not persist an object
"Sean C. Sullivan" <[email protected]>
| Newsgroups | gmane.comp.java.openamf.user |
|---|---|
| Message-ID | <[email protected]> |
OpenAMF uses JavaBeans introspection to discover the "getter" methods.
If you implement a BeanInfo class, you can explicitly return an array of
PropertyDescriptor objects.
OpenAMF will process only properties that you include in the
PropertyDescriptor array.
Here's an example:
File: Foo.java
public class Foo
{
private String a;
private String b;
public Foo()
{
}
public String getA()
{
return a;
}
public void setA(String value)
{
this.a = value;
}
public String getB()
{
return b;
}
public void setB(String value)
{
this.b = value;
}
}
File: FooBeanInfo.java
import java.beans.*;
public class FooBeanInfo extends java.beans.SimpleBeanInfo
{
public PropertyDescriptor[] getPropertyDescriptors()
{
PropertyDescriptor[] props = new PropertyDescriptor[1];
try
{
// Create a property descriptor for "a" only
PropertyDescriptor pd = new PropertyDescriptor("a", Foo.class);
props[0] = pd;
}
catch (IntrospectionException ex)
{
ex.printStackTrace();
}
return props;
}
}
Dan Glauser wrote:
> Hello all,
>
> I have a group of nested objects that I am trying to send over the
> wire with OpenAMF. I would like the AMFSerializer to not serialize
> one of the object's properties. I need to have a getter for this
> property however because this property is managed via Hibernate.
>
> Any advice would be appreciated.
>
> Thanks!
>
> --
> Dan
> [email protected]
-------------------------------------------------------
SF.Net email is sponsored by: Tell us your software development plans!
Take this survey and enter to win a one-year sub to SourceForge.net
Plus IDC's 2005 look-ahead and a copy of this survey
Click here to start! http://www.idcswdc.com/cgi-bin/survey?id=105hix