pascallouisperez / jsonmarshaller

JsonMarshaller is a Java 1.5 library that allows marshalling and unmarshalling of JSON objects to and from entities ("Java classes").
Apache License 2.0
1 stars 0 forks source link

Support top-level marshalling of Java Number, String, and Boolean types #26

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
System.out.println(
  TwoLattes.createMarshaller(Long.class)
    .marshallList(asList(123L, 9876543210L))
    .toString());

What is the expected output? What do you see instead?
Expected: [123,9876543210]
Actual:
java.lang.IllegalArgumentException: class java.lang.Long is not an entity.
Entities must be annotated with @Entity.
    at com.twolattes.json.DescriptorFactory.create(DescriptorFactory.java:30)
    at com.twolattes.json.MarshallerImpl.<init>(MarshallerImpl.java:23)
    at com.twolattes.json.TwoLattes$Builder.createMarshaller(TwoLattes.java:60)
    at com.twolattes.json.TwoLattes.createMarshaller(TwoLattes.java:27)
    ...

Original issue reported on code.google.com by jaredjac...@gmail.com on 28 Nov 2009 at 10:33

GoogleCodeExporter commented 9 years ago
For the example given, Long.TYPE should also work.

We'd also want to have registered types working that way

System.out.println(
  TwoLattes
    .withType(IdType.class)
    .createMarshaller(Id.class)
    .marshallList(asList(new Id(5), new Id(8)))
    .toString());

Original comment by pascallo...@gmail.com on 28 Nov 2009 at 11:05

GoogleCodeExporter commented 9 years ago
I don't understand the comment by pascallouisperez? Is it possible to marshall a
List<Double> for example?

Original comment by reich.ma...@gmail.com on 2 Dec 2009 at 11:51

GoogleCodeExporter commented 9 years ago
Currently the JsonMarshaller alllows marshalling of entities only. This issue is
about extending it to allow marhsalling values, as if they were top-level 
entities.

Original comment by pascallo...@gmail.com on 2 Dec 2009 at 1:29

GoogleCodeExporter commented 9 years ago

Original comment by jaredjac...@gmail.com on 11 Apr 2010 at 5:56