You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pivot.apache.org by Niclas Hedhman <ni...@hedhman.org> on 2009/06/24 07:21:36 UTC
Serializable?
Gang,
what is the reasoning of not making anything in Pivot serializable? I
need simple structures like Point and Bounds to be serialized, and
would hate to create my own storage objects for such thing.
Cheers
--
Niclas Hedhman, Software Developer
http://www.qi4j.org - New Energy for Java
I live here; http://tinyurl.com/2qq9er
I work here; http://tinyurl.com/2ymelc
I relax here; http://tinyurl.com/2cgsug
Re: Serializable?
Posted by Greg Brown <gk...@mac.com>.
No reason. They could probably be Serializable. I'll make this change.
On Jun 24, 2009, at 1:21 AM, Niclas Hedhman wrote:
> Gang,
>
> what is the reasoning of not making anything in Pivot serializable? I
> need simple structures like Point and Bounds to be serialized, and
> would hate to create my own storage objects for such thing.
>
>
> Cheers
> --
> Niclas Hedhman, Software Developer
> http://www.qi4j.org - New Energy for Java
>
> I live here; http://tinyurl.com/2qq9er
> I work here; http://tinyurl.com/2ymelc
> I relax here; http://tinyurl.com/2cgsug
Re: Serializable?
Posted by Greg Brown <gk...@mac.com>.
Some serializers do support customization. For example, CSVSerializer
lets the caller specify the class of the item that will be used to
contain the deserialized row data. Others, such as JSONSerializer, do
not - JSON is hierarchical and doesn't support a means of specifying
an expected structure. Without that, it would be difficult to say
that, for example, a node 3 levels down at a given path should be
deserialized using MyMapClass vs. HashMap.
On Jun 24, 2009, at 4:24 AM, Sandro Martini wrote:
> Hi Niclas,
> i think this is because of the Serializers approach, with all
> serialization details inside, and to ensure that none can transfer
> object instances where not wanted (for example GUI elements).
>
> The problem could be with objects that are not directly supported by
> Serializers (some time ago i had a discussion with the team, but my
> proposal to generalize things has been rejected :(- because some
> things would be more complicated than current).
>
> Maybe in this case we could think to use some way to do this using
> introspection (for example for beans), or other approach ... Greg can
> tell if some other is already available.
>
>
> Otherwise i could propose (another time) my old proposal to set
> optional handlers inside Serializers, and let developers handle custom
> objects inside some of them ... tell me if you like this.
> For example, is JSONSerializer there is nothing that handle Date
> objects (because in JSON specifications they aren't handles, a flaw in
> the spec, in my opinion) and currently the developer has to handle
> this otherwise an Exception will be thrown.
> With my proposal with serializer handlers, the default if the same,
> but if i put a dedicated handler, this could be transparent ...
>
> What do you think ?
>
> Bye,
> Sandro
Re: Serializable?
Posted by Greg Brown <gk...@mac.com>.
> So, I think am good to drop my storage classes and become more
> dependent on Pivot *sigh* ;-)
You could store them in a platform-independent manner (e.g. JSON) and
serialize them into Pivot types. But I won't object to your writing
code that is dependent on Pivot. :-)
Re: Serializable?
Posted by Niclas Hedhman <ni...@hedhman.org>.
On Wed, Jun 24, 2009 at 9:24 PM, Greg Brown<gk...@mac.com> wrote:
>> We are talking about 6-10 classes, and I
>> can manage that with 'replicas'.
>
> No need - it was a good suggestion to make those data classes serializable.
> No reason for them not to be.
Ok, cool...
> However, I wouldn't go so far as to make everything in WTK serializable (as
> AWT does with Component). If you want to serialize a UI structure, you
> should probably be using WTKX (or something similar).
Correct. I only need the 'properties' of a manual layout, i.e.
location, size of images and parts inside visual components and stuff
like that. When the "workspace" is loaded from storage it will be
rendered from scratch.
So, I think am good to drop my storage classes and become more
dependent on Pivot *sigh* ;-)
Cheers
--
Niclas Hedhman, Software Developer
http://www.qi4j.org - New Energy for Java
I live here; http://tinyurl.com/2qq9er
I work here; http://tinyurl.com/2ymelc
I relax here; http://tinyurl.com/2cgsug
Re: Serializable?
Posted by Sandro Martini <sa...@gmail.com>.
Hi Greg,
> Just the data classes (Point, Dimensions, etc.).
Ok.
> Are you subscribed to pivot-commits? If not, you should do so.
Ok.
Thanks,
Sandro
Re: Serializable?
Posted by Greg Brown <gk...@mac.com>.
> Ok, but what classes have you become Serializable (not the full list,
> only few info ... for curiosity until next synchronize) ?
Just the data classes (Point, Dimensions, etc.).
Are you subscribed to pivot-commits? If not, you should do so.
Re: Serializable?
Posted by Sandro Martini <sa...@gmail.com>.
Hi to all,
sorry for the confusion with my (supposed) answer ... i was
remembering an old (many many months ago) discussion on this:
I was using a powerful library, cajo (from dev.java.net, that handle
the execution of remote methods in a transparent way all objects, via
RMI but without exposing it) and in a demo they serialize between
different JVM a tree of GUI Components, so i asked if this could be
achieved with Pivot GUI ... and the result was no (for full Pivot GUI
or Components).
But in the meantime probably many things have changed ...
Oh, if someone has some time, take a look at that library (
https://cajo.dev.java.net/ ), it's very powerful and simple !!
I hope to find time to make a future application (and maybe in a Demo)
to mix Pivot with Cajo, but it's licensed under LGPL version 3, so I
don't know if it will be possible to put inside standard Demos (Apache
License), and if accepted by the team.
> This change has been submitted.
Ok, but what classes have you become Serializable (not the full list,
only few info ... for curiosity until next synchronize) ?
Bye,
Sandro
Re: Serializable?
Posted by Greg Brown <gk...@mac.com>.
> We are talking about 6-10 classes, and I
> can manage that with 'replicas'.
No need - it was a good suggestion to make those data classes
serializable. No reason for them not to be.
However, I wouldn't go so far as to make everything in WTK
serializable (as AWT does with Component). If you want to serialize a
UI structure, you should probably be using WTKX (or something similar).
Re: Serializable?
Posted by Niclas Hedhman <ni...@hedhman.org>.
On Wed, Jun 24, 2009 at 4:24 PM, Sandro Martini wrote: > Hi Niclas, > i
think this is because of the Serializers approach, with all > serialization
details inside, and to ensure that none can transfer > object instances
where not wanted (for example GUI elements). Ok. Your starting point is of
course very different. > The problem could be with objects that are not
directly supported by > Serializers (some time ago i had a discussion with
the team, but my > proposal to generalize things has been rejected :(-
because some > things would be more complicated than current). In my case,
the situation is actually quite different. I depend on a very specific
framework[1] that as a "last resort" will also be able to store
Serializables. Since the UI information I want to store is meshed up with
many, many other non-Pivot stuff, I can't really handle the Pivot solution
either. But don't worry about it. We are talking about 6-10 classes, and I
can manage that with 'replicas'. [1] http://www.qi4j.org Cheers -- Niclas
Hedhman, Software Developer http://www.qi4j.org - New Energy for Java I live
here; http://tinyurl.com/2qq9er I work here; http://tinyurl.com/2ymelc I
relax here; http://tinyurl.com/2cgsug
Re: Serializable?
Posted by Sandro Martini <sa...@gmail.com>.
Hi Niclas,
i think this is because of the Serializers approach, with all
serialization details inside, and to ensure that none can transfer
object instances where not wanted (for example GUI elements).
The problem could be with objects that are not directly supported by
Serializers (some time ago i had a discussion with the team, but my
proposal to generalize things has been rejected :(- because some
things would be more complicated than current).
Maybe in this case we could think to use some way to do this using
introspection (for example for beans), or other approach ... Greg can
tell if some other is already available.
Otherwise i could propose (another time) my old proposal to set
optional handlers inside Serializers, and let developers handle custom
objects inside some of them ... tell me if you like this.
For example, is JSONSerializer there is nothing that handle Date
objects (because in JSON specifications they aren't handles, a flaw in
the spec, in my opinion) and currently the developer has to handle
this otherwise an Exception will be thrown.
With my proposal with serializer handlers, the default if the same,
but if i put a dedicated handler, this could be transparent ...
What do you think ?
Bye,
Sandro
Re: Serializable?
Posted by Greg Brown <gk...@mac.com>.
This change has been submitted.
On Jun 24, 2009, at 1:21 AM, Niclas Hedhman wrote:
> Gang,
>
> what is the reasoning of not making anything in Pivot serializable? I
> need simple structures like Point and Bounds to be serialized, and
> would hate to create my own storage objects for such thing.
>
>
> Cheers
> --
> Niclas Hedhman, Software Developer
> http://www.qi4j.org - New Energy for Java
>
> I live here; http://tinyurl.com/2qq9er
> I work here; http://tinyurl.com/2ymelc
> I relax here; http://tinyurl.com/2cgsug