Re: How to not persist an object
"Sean C. Sullivan" <[email protected]>
| Newsgroups | gmane.comp.java.openamf.user |
|---|---|
| Message-ID | <[email protected]> |
The 'transient' keyword will have no effect. OpenAMF does not use Java serialization. OpenAMF uses JavaBeans introspection to discover JavaBean properties. The only way to modify the behavior is: modify the OpenAMF source code OR implement a FooBeanInfo class for each Java class where you need to force certain properties to be ignored Cheers, -Sean >-- Original Message -- >From: Leif Wells <[email protected]> >To: [email protected] >Subject: Re: [Openamf-user] How to not persist an object >Reply-To: [email protected] >Date: Thu, 28 Apr 2005 09:38:32 -0400 > > >(I've inherited this issue from Dan, but I'm still a beginner here, so be > >gentle) > >Todd: I'll look into the "transient" keyword since I've never seen that >before. > >Sean: I have a couple of questions: > >In your example, what exactly are you sending to Open-AMF? >Are we sending Foo? Or FooInfoBean? > >And how do Foo and FooInfoBean relate to each other? > >Thanks, > >Leif > >On 4/28/05, Sean C. Sullivan <[email protected]> wrote: >> >> >> 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 <http://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<http://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 >> _______________________________________________ >> Openamf-user mailing list >> [email protected] >> https://lists.sourceforge.net/lists/listinfo/openamf-user >> ------------------------------------------------------- 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?id5hix