simple-support Mailing List for Simple (Page 80)
Brought to you by:
niallg
You can subscribe to this list here.
| 2007 |
Jan
|
Feb
(2) |
Mar
(2) |
Apr
(13) |
May
(13) |
Jun
(27) |
Jul
(4) |
Aug
(14) |
Sep
(7) |
Oct
|
Nov
(6) |
Dec
(24) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2008 |
Jan
|
Feb
(21) |
Mar
(10) |
Apr
(15) |
May
(24) |
Jun
(24) |
Jul
(30) |
Aug
(5) |
Sep
(19) |
Oct
(27) |
Nov
(16) |
Dec
(24) |
| 2009 |
Jan
(34) |
Feb
(24) |
Mar
(35) |
Apr
(26) |
May
(8) |
Jun
(17) |
Jul
(28) |
Aug
(31) |
Sep
(36) |
Oct
(35) |
Nov
(20) |
Dec
(16) |
| 2010 |
Jan
(40) |
Feb
(21) |
Mar
(47) |
Apr
(45) |
May
(34) |
Jun
(68) |
Jul
(46) |
Aug
(39) |
Sep
(47) |
Oct
(20) |
Nov
(42) |
Dec
(13) |
| 2011 |
Jan
(41) |
Feb
(16) |
Mar
(32) |
Apr
(44) |
May
(28) |
Jun
(35) |
Jul
(37) |
Aug
(33) |
Sep
(60) |
Oct
(20) |
Nov
(35) |
Dec
(23) |
| 2012 |
Jan
(34) |
Feb
(23) |
Mar
(34) |
Apr
(21) |
May
(48) |
Jun
(24) |
Jul
(31) |
Aug
(39) |
Sep
(25) |
Oct
(10) |
Nov
(27) |
Dec
(28) |
| 2013 |
Jan
(32) |
Feb
(24) |
Mar
(24) |
Apr
(9) |
May
(4) |
Jun
(6) |
Jul
(2) |
Aug
(5) |
Sep
|
Oct
(5) |
Nov
(1) |
Dec
(12) |
| 2014 |
Jan
(14) |
Feb
(16) |
Mar
(5) |
Apr
(3) |
May
(2) |
Jun
(8) |
Jul
(2) |
Aug
|
Sep
(6) |
Oct
|
Nov
(6) |
Dec
|
| 2015 |
Jan
(3) |
Feb
(15) |
Mar
(7) |
Apr
|
May
|
Jun
(1) |
Jul
|
Aug
|
Sep
(2) |
Oct
|
Nov
|
Dec
(1) |
| 2016 |
Jan
|
Feb
(6) |
Mar
(2) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2017 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(1) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2018 |
Jan
(1) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(1) |
Dec
|
| 2019 |
Jan
|
Feb
|
Mar
|
Apr
(1) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
|
From: Niall G. <gal...@ya...> - 2007-06-13 19:44:20
|
Hi,
Simple 1.3.1 has been release with support for null @Attribute and @Text values. This means that within the XML document the Java null value can be represented in a textual manner within the XML document. For example take the following:
@Root
public class Example {
@Attribute(empty="NULL")
private String name;
@Text(empty="NO TEXT HERE")
private String value;
public Example() {
super();
}
public Example(String name, String value) {
this.name = name;
this.value = value;
}
}
So if Persister.write was used on various instances of the Example class the output would look like follows:
1) new Example(null, null)
<example name="NULL>NO TEXT HERE</example>
2) new Example("Some Name", null)
<example name="Some Name">NO TEXT HERE</example>
3) new Example("Some Name", "Some Description")
<example name="Some Name">Some Description</example>
Deserialization will ensure that fields with the null text value will be assigned null. I have not yet had time to add support for null @Element, @ElementArray, or @ElementList.
Niall
----- Original Message ----
From: Niall Gallagher <gal...@ya...>
To: Niall Gallagher <gal...@ya...>; Keith Byrne <ka...@gm...>; sim...@li...
Sent: Tuesday, June 12, 2007 10:36:56 AM
Subject: Re: [Simple-support] Element/Attribute Default Values
Hi,
In future I hope to add an "empty" attribute to all of the annotations such that empty values can be inserted without having to bend over backwards to cope with null values. Ill be implementing something like
@Root
public class MyClass {
@Attribute(empty="NULL")
private String example;
}
Such that if the field "example" had a null value it would be written as follows:
<myClass example="NULL"/>
The deserialization process will know to substitute the specified value with null when reconstituting the object. For the @Element, @ElementList, and @ElementArray annotations the field will be a boolean like so:
@Root
public class MyOtherClass
{
@ElementList(empty=true)
private Collection<String> list;
}
The above annotation tells the persister to serialize the empty value such that the result of having a null list would be:
<myOtherClass>
<list/>
</myOtherClass>
Where as if the annotation was set not to write an empty value the resulting XML would be:
<myOtherClass/>
This requires only very minor changes, so will probably make it in soon enough.
Niall
----- Original Message ----
From: Niall Gallagher <gal...@ya...>
To: Keith Byrne <ka...@gm...>; sim...@li...
Sent: Monday, June 11, 2007 10:38:52 PM
Subject: Re: [Simple-support] Element/Attribute Default Values
Hi,
Yes there is a way to intercept, for example:
public class MyExample {
private static final DEFAULT_VALUE = "[[NULL]]";
@Element
private String webAddress
@Commit
private void resolveMyDefault() {
if(webAddress.equals(DEFAULT_VALUE)) {
webAddress = null;
}
}
@Persist
private void fixMyObject() {
if(webAddress == null){
webAddress = DEFAULT_VALUE:
}
}
@Complete
private void backToNormal() {
resolveMyDefault();
}
}
This should do the trick, as @Persist gets called just before the object is persisted, and @Complete gets called when its been serialized to the XML document. The @Commit gets called after deserialization so the object values will be reverted to a proper working runtime value.
Hope this helps.
Niall
----- Original Message ----
From: Keith Byrne <ka...@gm...>
To: sim...@li...
Sent: Monday, June 11, 2007 10:33:16 AM
Subject: [Simple-support] Element/Attribute Default Values
I have a situation where a field isn't required, but when it's null and is serialized, the tag still needs to show up empty. Specifically, there is a String field (webAddress) that has an Attribute annotation, that went it's null
should be serialized to <webAddress/>, instead of not showing up. Is there a way to intercept the serializing of an Element/Attribute, and based upon it's type, serialize a default value?
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Simple-support mailing list
Sim...@li...
https://lists.sourceforge.net/lists/listinfo/simple-support
Shape Yahoo! in your own image.
Join our Network Research Panel today!
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Simple-support mailing list
Sim...@li...
https://lists.sourceforge.net/lists/listinfo/simple-support
Got a little couch potato?
Check out fun summer activities for kids.
____________________________________________________________________________________
Looking for a deal? Find great prices on flights and hotels with Yahoo! FareChase.
http://farechase.yahoo.com/ |
|
From: Federico F. <fed...@fi...> - 2007-06-13 18:58:12
|
I've done it the second way
For the record, here is a snipped of what I've coded to serialize a
(quite) complex object model
@Root(name = "something")
public class SomethingXMLAdapter {
public static final SimpleDateFormat DATETIME_FORMAT = new
SimpleDateFormat(
"yyyyMMddhhmm");
private final Something innerSomething;
public SomethingXMLAdapter(Something something) {
this.innerSomething = something;
}
public SomethingXMLAdapter() {
this.innerSomething = new Something();
}
@Element(name = "stop-at")
public String getStopAt() {
return DATETIME_FORMAT.format(innerSomething.getStopAt());
}
@Element(name = "stop-at")
public void setStopAt(String stopAt) throws ParseException {
innerSomething.setStopAt(DATETIME_FORMAT.parse(stopAt));
}
}
|
|
From: Niall G. <gal...@ya...> - 2007-06-13 17:07:59
|
Hi,
Yes you should be able to serialize and deserialize dates without any trouble. Support for the java.util.Date is not included, as it is a pretty flakey object, that is all but deprecated. I would do something like:
@Root
public class MyObject {
@Element
public MyDate date;
}
@Root
public class MyDate {
@Attribute
private String getTime() {
return System.currentTimeMillis();
}
@Atttribute
private void setTime(long time) {
this.time = time;
}
public Date toDate() {
return new Date(time);
}
}
Which would look something like:
<myObject>
<myDate time="123456789"/>
</myObject>
Of course it may be better to use a string format to perform this like so:
@Root
public class MyObject {
private static final DateFormat formatter = new SimpleDateFormat("EEE, d MMM yyyy HH:mm:ss Z");
@Attribute
private String date;
private Date myDate;
@Commit
private void commit() throws Exception {
myDate = formatter.parse(date);
}
@Persist
private void persist() throws Exception {
date = formatter.format(myDate);
}
public void setDate(Date myDate) {
this.myDate = myDate;
}
public Date getDate() {
return myDate;
}
}
This allows XML like so:
<myDate time="Wed, 4 Jul 2001 12:08:56 -0700"/>
I have intentionally avoided supporting java.util.Date as it is such a poor date representation.
Niall
----- Original Message ----
From: "Zaffke, Micholas Mr CIV USA USAREUR" <Mic...@EU...>
To: sim...@li...
Sent: Wednesday, June 13, 2007 9:18:22 AM
Subject: [Simple-support] Date
<!--
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0in;margin-bottom:.0001pt;font-size:12.0pt;font-family:"Times New Roman";}
a:link, span.MsoHyperlink
{color:blue;text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{color:purple;text-decoration:underline;}
span.EmailStyle17
{font-family:Arial;color:windowtext;}
_filtered {margin:1.0in 1.25in 1.0in 1.25in;}
div.Section1
{}
-->
Does Simple have any support for Date data types? My object
holds a java.util.Date but when I persist it to XML the result contains this:
<DATE class="java.sql.Timestamp"/>
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Simple-support mailing list
Sim...@li...
https://lists.sourceforge.net/lists/listinfo/simple-support
____________________________________________________________________________________
Be a better Heartthrob. Get better relationship answers from someone who knows. Yahoo! Answers - Check it out.
http://answers.yahoo.com/dir/?link=list&sid=396545433 |
|
From: Zaffke, M. Mr C. U. U. <Mic...@EU...> - 2007-06-13 16:19:07
|
Does Simple have any support for Date data types? My object holds a java.util.Date but when I persist it to XML the result contains this: <DATE class=3D"java.sql.Timestamp"/> |
|
From: Marco V. <ve...@zh...> - 2007-06-12 11:19:09
|
Ok, thanks a lot for your work.
Niall Gallagher wrote:
> I agree, Ill make sure this is fixed in the next release....
>
> ----- Original Message ----
> From: Federico Fissore <fed...@fi...>
> To: sim...@li...
> Sent: Tuesday, June 12, 2007 12:05:24 PM
> Subject: Re: [Simple-support] Bug in Persister
>
> Marco Vergari ha scritto:
>> public <T> T read(Class<? extends T> type, File source) throws Exception {
>> FileInputStream fis = new FileInputStream(source); // Patch: Close the
>> FileInputStream
>> try {
>> return (T)read(type, fis);
>> } finally {
>> fis.close();
>> }
>> }
>>
>>
> uhhm... IMHO the method should work with the object without changing its
> state. That said, read methods that use "raw" inputstream and reader
> should leave that stream/reader the way they received it, avoinding to
> close it
>
> Instead, read methods that accept String and File should close it, as
> they created and opened the corresponding stream/reader
|
|
From: Niall G. <gal...@ya...> - 2007-06-12 11:17:14
|
I agree, Ill make sure this is fixed in the next release....
----- Original Message ----
From: Federico Fissore <fed...@fi...>
To: sim...@li...
Sent: Tuesday, June 12, 2007 12:05:24 PM
Subject: Re: [Simple-support] Bug in Persister
Marco Vergari ha scritto:
> public <T> T read(Class<? extends T> type, File source) throws Exception {
> FileInputStream fis = new FileInputStream(source); // Patch: Close the
> FileInputStream
> try {
> return (T)read(type, fis);
> } finally {
> fis.close();
> }
> }
>
>
uhhm... IMHO the method should work with the object without changing its
state. That said, read methods that use "raw" inputstream and reader
should leave that stream/reader the way they received it, avoinding to
close it
Instead, read methods that accept String and File should close it, as
they created and opened the corresponding stream/reader
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Simple-support mailing list
Sim...@li...
https://lists.sourceforge.net/lists/listinfo/simple-support
____________________________________________________________________________________
Luggage? GPS? Comic books?
Check out fitting gifts for grads at Yahoo! Search
http://search.yahoo.com/search?fr=oni_on_mail&p=graduation+gifts&cs=bz
|
|
From: Marco V. <ve...@zh...> - 2007-06-12 11:17:03
|
You have right the method should work with the object without changing
its state. Only the following methods should close their created streams
and readers:
- public <T> T read(Class<? extends T> type, String source) throws Exception
- public <T> T read(Class<? extends T> type, File source) throws Exception {
- public void write(Object source, File out) throws Exception {
Federico Fissore wrote:
> Marco Vergari ha scritto:
>> public <T> T read(Class<? extends T> type, File source) throws Exception {
>> FileInputStream fis = new FileInputStream(source); // Patch: Close the
>> FileInputStream
>> try {
>> return (T)read(type, fis);
>> } finally {
>> fis.close();
>> }
>> }
>>
>>
> uhhm... IMHO the method should work with the object without changing its
> state. That said, read methods that use "raw" inputstream and reader
> should leave that stream/reader the way they received it, avoinding to
> close it
>
> Instead, read methods that accept String and File should close it, as
> they created and opened the corresponding stream/reader
>
>
> -------------------------------------------------------------------------
> This SF.net email is sponsored by DB2 Express
> Download DB2 Express C - the FREE version of DB2 express and take
> control of your XML. No limits. Just data. Click to get it now.
> http://sourceforge.net/powerbar/db2/
> _______________________________________________
> Simple-support mailing list
> Sim...@li...
> https://lists.sourceforge.net/lists/listinfo/simple-support
|
|
From: Federico F. <fed...@fi...> - 2007-06-12 11:05:35
|
Marco Vergari ha scritto:
> public <T> T read(Class<? extends T> type, File source) throws Exception {
> FileInputStream fis = new FileInputStream(source); // Patch: Close the
> FileInputStream
> try {
> return (T)read(type, fis);
> } finally {
> fis.close();
> }
> }
>
>
uhhm... IMHO the method should work with the object without changing its
state. That said, read methods that use "raw" inputstream and reader
should leave that stream/reader the way they received it, avoinding to
close it
Instead, read methods that accept String and File should close it, as
they created and opened the corresponding stream/reader
|
|
From: Marco V. <ve...@zh...> - 2007-06-12 10:48:46
|
Hi all
Mike Quilleash has at 08.05.2007 "Bug in Persister" posted. I have
established the samething as he. The Input/Output streams are not be
closed after whose use.
For me I patched it as following:
public <T> T read(Class<? extends T> type, File source) throws Exception {
FileInputStream fis = new FileInputStream(source); // Patch: Close the
FileInputStream
try {
return (T)read(type, fis);
} finally {
fis.close();
}
}
The same I have done in the other reader methods and in the writer methods.
Do you plan to fix this in the next release?
Best Regards,
Marco
|
|
From: Niall G. <gal...@ya...> - 2007-06-12 09:37:07
|
Hi,
In future I hope to add an "empty" attribute to all of the annotations such that empty values can be inserted without having to bend over backwards to cope with null values. Ill be implementing something like
@Root
public class MyClass {
@Attribute(empty="NULL")
private String example;
}
Such that if the field "example" had a null value it would be written as follows:
<myClass example="NULL"/>
The deserialization process will know to substitute the specified value with null when reconstituting the object. For the @Element, @ElementList, and @ElementArray annotations the field will be a boolean like so:
@Root
public class MyOtherClass {
@ElementList(empty=true)
private Collection<String> list;
}
The above annotation tells the persister to serialize the empty value such that the result of having a null list would be:
<myOtherClass>
<list/>
</myOtherClass>
Where as if the annotation was set not to write an empty value the resulting XML would be:
<myOtherClass/>
This requires only very minor changes, so will probably make it in soon enough.
Niall
----- Original Message ----
From: Niall Gallagher <gal...@ya...>
To: Keith Byrne <ka...@gm...>; sim...@li...
Sent: Monday, June 11, 2007 10:38:52 PM
Subject: Re: [Simple-support] Element/Attribute Default Values
Hi,
Yes there is a way to intercept, for example:
public class MyExample {
private static final DEFAULT_VALUE = "[[NULL]]";
@Element
private String webAddress
@Commit
private void resolveMyDefault() {
if(webAddress.equals(DEFAULT_VALUE)) {
webAddress = null;
}
}
@Persist
private void fixMyObject() {
if(webAddress == null){
webAddress = DEFAULT_VALUE:
}
}
@Complete
private void backToNormal() {
resolveMyDefault();
}
}
This should do the trick, as @Persist gets called just before the object is persisted, and @Complete gets called when its been serialized to the XML document. The @Commit gets called after deserialization so the object values will be reverted to a proper working runtime value.
Hope this helps.
Niall
----- Original Message ----
From: Keith Byrne <ka...@gm...>
To: sim...@li...
Sent: Monday, June 11, 2007 10:33:16 AM
Subject: [Simple-support] Element/Attribute Default Values
I have a situation where a field isn't required, but when it's null and is serialized, the tag still needs to show up empty. Specifically, there is a String field (webAddress) that has an Attribute annotation, that went it's null
should be serialized to <webAddress/>, instead of not showing up. Is there a way to intercept the serializing of an Element/Attribute, and based upon it's type, serialize a default value?
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Simple-support mailing list
Sim...@li...
https://lists.sourceforge.net/lists/listinfo/simple-support
Shape Yahoo! in your own image.
Join our Network Research Panel today!
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Simple-support mailing list
Sim...@li...
https://lists.sourceforge.net/lists/listinfo/simple-support
____________________________________________________________________________________
Fussy? Opinionated? Impossible to please? Perfect. Join Yahoo!'s user panel and lay it on us. http://surveylink.yahoo.com/gmrs/yahoo_panel_invite.asp?a=7
|
|
From: Niall G. <gal...@ya...> - 2007-06-11 21:38:59
|
Hi,
Yes there is a way to intercept, for example:
public class MyExample {
private static final DEFAULT_VALUE = "[[NULL]]";
@Element
private String webAddress
@Commit
private void resolveMyDefault() {
if(webAddress.equals(DEFAULT_VALUE)) {
webAddress = null;
}
}
@Persist
private void fixMyObject() {
if(webAddress == null){
webAddress = DEFAULT_VALUE:
}
}
@Complete
private void backToNormal() {
resolveMyDefault();
}
}
This should do the trick, as @Persist gets called just before the object is persisted, and @Complete gets called when its been serialized to the XML document. The @Commit gets called after deserialization so the object values will be reverted to a proper working runtime value.
Hope this helps.
Niall
----- Original Message ----
From: Keith Byrne <ka...@gm...>
To: sim...@li...
Sent: Monday, June 11, 2007 10:33:16 AM
Subject: [Simple-support] Element/Attribute Default Values
I have a situation where a field isn't required, but when it's null and is serialized, the tag still needs to show up empty. Specifically, there is a String field (webAddress) that has an Attribute annotation, that went it's null should be serialized to <webAddress/>, instead of not showing up. Is there a way to intercept the serializing of an Element/Attribute, and based upon it's type, serialize a default value?
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Simple-support mailing list
Sim...@li...
https://lists.sourceforge.net/lists/listinfo/simple-support
____________________________________________________________________________________
Sick sense of humor? Visit Yahoo! TV's
Comedy with an Edge to see what's on, when.
http://tv.yahoo.com/collections/222 |
|
From: Keith B. <ka...@gm...> - 2007-06-11 17:33:20
|
I have a situation where a field isn't required, but when it's null and is serialized, the tag still needs to show up empty. Specifically, there is a String field (webAddress) that has an Attribute annotation, that went it's null should be serialized to <webAddress/>, instead of not showing up. Is there a way to intercept the serializing of an Element/Attribute, and based upon it's type, serialize a default value? |
|
From: Niall G. <gal...@ya...> - 2007-06-09 23:25:18
|
Hi,=0A=0AYes, Java enums are supported, all you need to do is add them to a=
n annotation. For example=0A=0Apublic enum MyEnum {=0A ONE,=0A TWO,=
=0A THREE=0A}=0A=0A@Root=0Apublic class MyExample {=0A=0A @Element=0A =
private MyEnum element;=0A=0A @Attribute=0A private MyEnum attribute;=
=0A}=0A=0AThis can be used with XML like so:=0A=0A<myExample attribute=3D"O=
NE">=0A <element>TWO</element>=0A</myExample>=0A=0AThe Enum.name() method=
is used to determine the exact enum to use. This is bidirectionally serial=
izable.=0A=0ANiall=0A=0A=0A=0A=0A=0A=0A----- Original Message ----=0AFrom: =
Est=EAv=E3o Monteiro <es...@gm...>=0ATo: sim...@li...=
orge.net=0ASent: Saturday, June 9, 2007 12:08:01 PM=0ASubject: [Simple-supp=
ort] typesafe enums=0A=0AHi! Nice work! Simple has greatly helped my projec=
ts both at work and at home!=0A=0AI'd like to ask if there are plans to sup=
port typesafe enums, or if it is already supported. Thanks!=0A=0A----------=
---------------------------------------------------------------=0AThis SF.n=
et email is sponsored by DB2 Express=0ADownload DB2 Express C - the FREE ve=
rsion of DB2 express and take=0Acontrol of your XML. No limits. Just data. =
Click to get it now.=0Ahttp://sourceforge.net/powerbar/db2/=0A_____________=
__________________________________=0ASimple-support mailing list=0ASimple-s=
up...@li...=0Ahttps://lists.sourceforge.net/lists/listinfo=
/simple-support=0A=0A=0A=0A=0A=0A=0A=0A =0A__________________________=
__________________________________________________________=0ANeed a vacatio=
n? Get great deals=0Ato amazing places on Yahoo! Travel.=0Ahttp://travel.ya=
hoo.com/ |
|
From: <es...@gm...> - 2007-06-09 19:08:03
|
Hi! Nice work! Simple has greatly helped my projects both at work and at home! I'd like to ask if there are plans to support typesafe enums, or if it is already supported. Thanks! |
|
From: Niall G. <gal...@ya...> - 2007-06-05 20:21:05
|
Hi,
Just to mention, as I was patching a fix for the Java 6 compilation problem for release 1.3 earlier today I popped in this patch too. So you can use @Validate, @Commit, @Persist, and @Complete on private methods. All you need to do is download 1.3 again.
Niall
----- Original Message ----
From: Marco Vergari <ve...@zh...>
To: sim...@li...
Sent: Monday, June 4, 2007 12:12:22 PM
Subject: [Simple-support] Enhancement request
Hi
I found your Simple XML serialization framework. It's a great software.
It saved me a lot of work.
When I use the "@Commit" annotation the methode must be declared public.
I want that this methode is only accessible for the simple xml
serializer. I want to declare the methode private. For this the
setAccessible(true) methode must be called before the methode is
invoked. Otherwise IllegalAccessException will be thrown.
For me I have patched the class simple.xml.load.Schema as following:
public void commit(Object source) throws Exception {
if(commit != null) {
commit.setAccessible(true); //Patch: So you can invoke private methode
if(isContextual(commit)) {
commit.invoke(source, table);
} else {
commit.invoke(source);
}
}
}
The same I have done for the annotation "@Validate", "@Persist" and
"@Complete".
Wath do you think about this enhancement?
Best Regards,
Marco
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Simple-support mailing list
Sim...@li...
https://lists.sourceforge.net/lists/listinfo/simple-support
____________________________________________________________________________________
Expecting? Get great news right away with email Auto-Check.
Try the Yahoo! Mail Beta.
http://advision.webevents.yahoo.com/mailbeta/newmail_tools.html
|
|
From: Federico F. <fed...@fi...> - 2007-06-05 10:07:23
|
Niall Gallagher ha scritto: > Hi, > > Thanks for this information, I have not yet built Simple on 1.6, I will attempt to build it today some time, and patch the 1.3 release (again). Can you show me some code that will cause the third error. > > I've discovered the third issue is related to wildcards attached there are some test classes |
|
From: Niall G. <gal...@ya...> - 2007-06-05 09:05:20
|
Hi,
Thanks for this information, I have not yet built Simple on 1.6, I will attempt to build it today some time, and patch the 1.3 release (again). Can you show me some code that will cause the third error.
Cheers,
Niall
----- Original Message ----
From: Federico Fissore <fed...@fi...>
To: sim...@li...
Sent: Tuesday, June 5, 2007 9:24:46 AM
Subject: [Simple-support] some issues
here are three issues I'm having
The return type is incompatible with LinkedList<InputNode>.push(InputNode)
InputStack.java @ line 95
The return type is incompatible with LinkedList<OutputNode>.push(OutputNode)
OutputStack.java @ line 104
these two errors occur when you try to build simple against jdk >=1.6.
it's due to jdk6 having added "void push" method to LinkedList
they were present even in simple 1.2 (the first version I've used)
===========================
and here's the stack trace of the third error. this occurs since 1.3: I
haven't had it with 1.2.1
java.lang.ClassCastException:
sun.reflect.generics.reflectiveObjects.ParameterizedTypeImpl
at simple.xml.load.ReadPart.getDependant(ReadPart.java:113)
at simple.xml.load.MethodContact.<init>(MethodContact.java:79)
at simple.xml.load.MethodScanner.build(MethodScanner.java:285)
at simple.xml.load.MethodScanner.build(MethodScanner.java:258)
at simple.xml.load.MethodScanner.build(MethodScanner.java:234)
at simple.xml.load.MethodScanner.scan(MethodScanner.java:106)
at simple.xml.load.MethodScanner.<init>(MethodScanner.java:86)
at simple.xml.load.Scanner.method(Scanner.java:361)
at simple.xml.load.Scanner.process(Scanner.java:334)
at simple.xml.load.Scanner.scan(Scanner.java:248)
at simple.xml.load.Scanner.<init>(Scanner.java:104)
at simple.xml.load.Source.getName(Source.java:222)
at simple.xml.load.Traverser.getName(Traverser.java:192)
at simple.xml.load.Traverser.write(Traverser.java:137)
at simple.xml.load.Traverser.write(Traverser.java:120)
at simple.xml.load.Persister.write(Persister.java:440)
at simple.xml.load.Persister.write(Persister.java:422)
at simple.xml.load.Persister.write(Persister.java:403)
at simple.xml.load.Persister.write(Persister.java:513)
[... my test classes...]
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Simple-support mailing list
Sim...@li...
https://lists.sourceforge.net/lists/listinfo/simple-support
____________________________________________________________________________________
Boardwalk for $500? In 2007? Ha! Play Monopoly Here and Now (it's updated for today's economy) at Yahoo! Games.
http://get.games.yahoo.com/proddesc?gamekey=monopolyherenow
|
|
From: Federico F. <fed...@fi...> - 2007-06-05 08:24:56
|
here are three issues I'm having
The return type is incompatible with LinkedList<InputNode>.push(InputNode)
InputStack.java @ line 95
The return type is incompatible with LinkedList<OutputNode>.push(OutputNode)
OutputStack.java @ line 104
these two errors occur when you try to build simple against jdk >=1.6.
it's due to jdk6 having added "void push" method to LinkedList
they were present even in simple 1.2 (the first version I've used)
===========================
and here's the stack trace of the third error. this occurs since 1.3: I
haven't had it with 1.2.1
java.lang.ClassCastException:
sun.reflect.generics.reflectiveObjects.ParameterizedTypeImpl
at simple.xml.load.ReadPart.getDependant(ReadPart.java:113)
at simple.xml.load.MethodContact.<init>(MethodContact.java:79)
at simple.xml.load.MethodScanner.build(MethodScanner.java:285)
at simple.xml.load.MethodScanner.build(MethodScanner.java:258)
at simple.xml.load.MethodScanner.build(MethodScanner.java:234)
at simple.xml.load.MethodScanner.scan(MethodScanner.java:106)
at simple.xml.load.MethodScanner.<init>(MethodScanner.java:86)
at simple.xml.load.Scanner.method(Scanner.java:361)
at simple.xml.load.Scanner.process(Scanner.java:334)
at simple.xml.load.Scanner.scan(Scanner.java:248)
at simple.xml.load.Scanner.<init>(Scanner.java:104)
at simple.xml.load.Source.getName(Source.java:222)
at simple.xml.load.Traverser.getName(Traverser.java:192)
at simple.xml.load.Traverser.write(Traverser.java:137)
at simple.xml.load.Traverser.write(Traverser.java:120)
at simple.xml.load.Persister.write(Persister.java:440)
at simple.xml.load.Persister.write(Persister.java:422)
at simple.xml.load.Persister.write(Persister.java:403)
at simple.xml.load.Persister.write(Persister.java:513)
[... my test classes...]
|
|
From: Niall G. <gal...@ya...> - 2007-06-04 19:47:25
|
Hi,
I think its a reasonable enhancement. I really should have added this in the original implementation. Ill make sure to add it to the next release 1.3.1.
Niall
----- Original Message ----
From: Marco Vergari <ve...@zh...>
To: sim...@li...
Sent: Monday, June 4, 2007 12:12:22 PM
Subject: [Simple-support] Enhancement request
Hi
I found your Simple XML serialization framework. It's a great software.
It saved me a lot of work.
When I use the "@Commit" annotation the methode must be declared public.
I want that this methode is only accessible for the simple xml
serializer. I want to declare the methode private. For this the
setAccessible(true) methode must be called before the methode is
invoked. Otherwise IllegalAccessException will be thrown.
For me I have patched the class simple.xml.load.Schema as following:
public void commit(Object source) throws Exception {
if(commit != null) {
commit.setAccessible(true); //Patch: So you can invoke private methode
if(isContextual(commit)) {
commit.invoke(source, table);
} else {
commit.invoke(source);
}
}
}
The same I have done for the annotation "@Validate", "@Persist" and
"@Complete".
Wath do you think about this enhancement?
Best Regards,
Marco
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Simple-support mailing list
Sim...@li...
https://lists.sourceforge.net/lists/listinfo/simple-support
____________________________________________________________________________________
Need a vacation? Get great deals
to amazing places on Yahoo! Travel.
http://travel.yahoo.com/
|
|
From: Marco V. <ve...@zh...> - 2007-06-04 19:12:35
|
Hi
I found your Simple XML serialization framework. It's a great software.
It saved me a lot of work.
When I use the "@Commit" annotation the methode must be declared public.
I want that this methode is only accessible for the simple xml
serializer. I want to declare the methode private. For this the
setAccessible(true) methode must be called before the methode is
invoked. Otherwise IllegalAccessException will be thrown.
For me I have patched the class simple.xml.load.Schema as following:
public void commit(Object source) throws Exception {
if(commit != null) {
commit.setAccessible(true); //Patch: So you can invoke private methode
if(isContextual(commit)) {
commit.invoke(source, table);
} else {
commit.invoke(source);
}
}
}
The same I have done for the annotation "@Validate", "@Persist" and
"@Complete".
Wath do you think about this enhancement?
Best Regards,
Marco
|
|
From: Niall G. <gal...@ya...> - 2007-05-21 13:51:47
|
Hi Daniil, Currently the library is implemented with XML in mind. However should you wish to use the code to perform JSON serialization I think you could do it quite easily. I would recommend a new package such as "simple.json" and "simple.json.load" as attempting to build this into the framework could be a little difficult. To start the core functionality lies in the following classes: Traverser.java: This is where each class is prociessed in a depth first traversal, instantiation is done as a field/method is visited Composite.java: This is the core processing object, it makes use of the annotations to determine how to handle the parsing Scanner.java: This is where all reflective data is acquired and where the labels are created Label.java: This and all subclasses determine how the annotations are processed I think the code should be well documented so you should not have too much problems refactoring. Perhaps some slight changes to the Composite.java object and the simple.xml.stream package is all you need. I may take a look at this myself to see how much would be involved. Niall ----- Original Message ---- From: Daniil Sosonkin <da...@or...> To: sim...@li... Sent: Friday, May 18, 2007 12:28:45 AM Subject: [Simple-support] JSON Hi, I found SimpleXML library just recently and it is great. Saved me a lot of time. But I was just wondering if it would be possible to write a Serializer which will write not into XML format but into JSON format. This way one could switch between serialization on request without having to modify annotations (if not worse). It does seem to out of scope of SimpleXML since, as the name implies, it is designed to work with XML only. But nonetheless. I'd be glad to do it if given a few pointers. Daniil ------------------------------------------------------------------------- This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ _______________________________________________ Simple-support mailing list Sim...@li... https://lists.sourceforge.net/lists/listinfo/simple-support ____________________________________________________________________________________ TV dinner still cooling? Check out "Tonight's Picks" on Yahoo! TV. http://tv.yahoo.com/ |
|
From: Niall G. <gal...@ya...> - 2007-05-21 13:34:49
|
Hi, This is already implemented and is in the HEAD of the subversion repository. You can check it out with the following command: svn co https://svn.sourceforge.net/svnroot/simple/trunk/download/stream/ This will pass all test cases however it is still not finished so consider it beta code. The annotation you require is: @ElementList(inline=true) ArrayList<Book> books; Also, with the latest code if you don't specify the name you get the field name (i.e books), and if you don't specify the type you get the generic type if it is specified (i.e Book) so the above annotation will work as is. Niall ----- Original Message ---- From: Hrvoje Slavicek <hsl...@us...> To: ni...@us... Cc: hsl...@us... Sent: Monday, May 21, 2007 2:07:36 PM Subject: Simple XML elementList question? Message body follows: Hi, I found your Simple XML serialization framework and it is great piece of software. It saved me a lot of work. I have a question about element list I would like to do something like this I have 2 class @Root(name="book") Book{ .... } @Root(name="Library") class Library{ @Atribute(name="name") String name; @ElementList(?????????????) ArrayList<Book> books; } i would like to serialize Library to something like this <Library> <name>my lib</lib> <Book name="my book1"/> <Book name="my book2"/> <Book name="my book3"/> </Library> but I cant,I can get something like this <Library> <name>my lib</lib> <Books> <Book name="my book1"/> <Book name="my book2"/> <Book name="my book3"/> </Books> </Library> But I have XML Scheme specification which says what I have to have and that is example 1. Is there a way to achive this? Are there any plans to implement this feature in future? when can we expect this feature? Thank you very much, and keep doing good job. -- This message has been sent to you, a registered SourceForge.net user, by another site user, through the SourceForge.net site. This message has been delivered to your SourceForge.net mail alias. You may reply to this message using the "Reply" feature of your email client, or using the messaging facility of SourceForge.net at: https://sourceforge.net/sendmessage.php?touser=1346425 ____________________________________________________________________________________ Moody friends. Drama queens. Your life? Nope! - their life, your story. Play Sims Stories at Yahoo! Games. http://sims.yahoo.com/ |
|
From: Daniil S. <da...@or...> - 2007-05-17 23:29:01
|
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> </head> <body bgcolor="#ffffff" text="#000000"> <font size="-1"><font face="Tahoma">Hi,<br> <br> I found SimpleXML library just recently and it is great. Saved me a lot of time. But I was just wondering if it would be possible to write a Serializer which will write not into XML format but into JSON format. This way one could switch between serialization on request without having to modify annotations (if not worse). It does seem to out of scope of SimpleXML since, as the name implies, it is designed to work with XML only. But nonetheless. I'd be glad to do it if given a few pointers.<br> <br> Daniil<br> </font></font> </body> </html> |
|
From: Federico F. <fed...@fi...> - 2007-05-11 19:45:36
|
Niall Gallagher ha scritto: > Hi, > > Currently there the @Text annotation does not have an option > on serialization to wrap content within <![CDATA[ ]]> blocks. I > am adding a data="true|false" attribute to the @Text annotation which > will allow this. For now the only way to do this is to edit the > simple.xml.stream.Formatter object to wrap the text in a cdata block. > Support for this should be available soon. > > Niall > > Hi Niall, I would recommend to have such attribute even on @Element and @ElementArray annotations Thank you Federico > ----- Original Message ---- > From: Federico Fissore <fed...@fi...> > To: sim...@li... > Sent: Friday, May 11, 2007 8:38:07 AM > Subject: [Simple-support] CDATA > > Hi all, > > what should I do to wrap long text into <![CDATA[ ]]> ? > > ------------------------------------------------------------------------- > This SF.net email is sponsored by DB2 Express > Download DB2 Express C - the FREE version of DB2 express and take > control of your XML. No limits. Just data. Click to get it now. > http://sourceforge.net/powerbar/db2/ > _______________________________________________ > Simple-support mailing list > Sim...@li... > https://lists.sourceforge.net/lists/listinfo/simple-support > > > > > > > ____________________________________________________________________________________ > We won't tell. Get more on shows you hate to love > (and love to hate): Yahoo! TV's Guilty Pleasures list. > http://tv.yahoo.com/collections/265 > > |
|
From: Niall G. <gal...@ya...> - 2007-05-11 16:40:30
|
Hi, Currently there the @Text annotation does not have an option on serialization to wrap content within <![CDATA[ ]]> blocks. I am adding a data="true|false" attribute to the @Text annotation which will allow this. For now the only way to do this is to edit the simple.xml.stream.Formatter object to wrap the text in a cdata block. Support for this should be available soon. Niall ----- Original Message ---- From: Federico Fissore <fed...@fi...> To: sim...@li... Sent: Friday, May 11, 2007 8:38:07 AM Subject: [Simple-support] CDATA Hi all, what should I do to wrap long text into <![CDATA[ ]]> ? ------------------------------------------------------------------------- This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ _______________________________________________ Simple-support mailing list Sim...@li... https://lists.sourceforge.net/lists/listinfo/simple-support ____________________________________________________________________________________ We won't tell. Get more on shows you hate to love (and love to hate): Yahoo! TV's Guilty Pleasures list. http://tv.yahoo.com/collections/265 |