On 2009-11-20 14.30, Niclas Hedhman wrote:
Sorry, wasn't isPrimitive() but the propertyType.type().isString()
resolving to true for a ValueComposite.

Since, I obviously don't understand that ValueType system, I would
like to have this either explained formally. Questions;

Yeah, the ValueType system is currently very confused, since it is on two levels at the same time, thus doing neither.

One is the type in the Java sense, and the other is the type in the JSON sense. Hence:

1. What is isXyz() supposed to be used for?

They were supposed to be designating the JSON type (i.e. number, boolean, string), but currently it's a mixed bag, which causes confusion.

2. Why is Date/Enum/Value and others isString()?

Because they are Strings when serialized to JSON. That's why their types extend from AbstractStringType.

3. When how is it supposed to be used?

They were supposed to be used to help JSON serialization. But right now... I'm not sure, since they're so mixed up.

Is it correct (by trying it works) to remove the if() statement...

     if ( propertyType.type().isString() )
     {
         return prop;
     }
     else
     {
         String json = "[" + prop + "]";
         JSONTokener tokener = new JSONTokener( json );
         JSONArray array = (JSONArray) tokener.nextValue();

and just let the json deserialization happen anyway???

That seems weird.

The type system needs to be cleaned up, for sure...

/Rickard

_______________________________________________
qi4j-dev mailing list
[email protected]
http://lists.ops4j.org/mailman/listinfo/qi4j-dev

Reply via email to