No time for this, sorry.
I repatched SerializableType and everything work again.
For the record, (and my solution is far from perfect) in ToJSON in do:
else if (value instanceof ValueComposite)
{
// Serialize ValueComposite JSON instead
CompositeInstance instance = (CompositeInstance)
Proxy.getInvocationHandler( value );
ValueDescriptor descriptor = (ValueDescriptor)
instance.descriptor();
ValueType valueType = descriptor.valueType();
try
{
JSONObject json = new JSONObject();
json.put("type", valueType.type().name());
json.put("content", valueType.toJSON(value));
return json;
}
catch (JSONException e)
{
throw new IllegalStateException( "Could not JSON serialize
value", e );
}
}
and in fromJSON:
if (json instanceof JSONObject)
{
// ValueComposite deserialization
String jsonType = ((JSONObject)
json).getString("type");
ValueDescriptor valueDescriptor = ((ModuleSPI)
module)
.valueDescriptor(jsonType);
return valueDescriptor.valueType().fromJSON(
((JSONObject)
json).getJSONObject("content"), module);
}
Anyway Rickard, thanks, I should really provide you with a failing junit
test... my fault.
philippe
Le 7 déc. 2009 à 16:19, philippe van dyck a écrit :
> Ok, I found something fishy, dunno if it is the only source of the problem.
>
> In ValueCompositeType :
>
> if (!value.getClass().getInterfaces()[0].getName().equals( type.name() ))
>
> getInterfaces Javadoc:
>
> The order of the interface objects in the array corresponds to
> the order of the interface names in the *implements* clause
> of the declaration of the class represented by this object.
>
> Or is there an order to follow ?
>
> phil
>
>
>
> Le 7 déc. 2009 à 15:41, philippe van dyck a écrit :
>
>> No go.
>>
>> I am getting Ambiguous Type Exception out of SerializableType.fromJSon.
>>
>> Maybe the real question here is .. why are my value composites serialized in
>> SerializableType .. and not ValueCompositeType ?
>>
>> any clue ?
>>
>> phil
>>
>> Le 30 nov. 2009 à 12:42, philippe van dyck a écrit :
>>
>>> Thanks a lot, I plan to update all qi4j-core and qi4j-extensions later
>>> today and run a suite of tests.
>>>
>>> phil
>>>
>>>
>>> Le 30 nov. 2009 à 12:25, Rickard Öberg a écrit :
>>>
>>>> On 2009-11-26 21.11, philippe van dyck wrote:
>>>>> Thanks Rickard, I am not upgrading to the latest version exactly for
>>>>> that reason... we already had numerous emails (on the list) regarding
>>>>> that issue. I am glad it is finally fixed and I will not need to
>>>>> maintain my patched one anymore.
>>>>
>>>> FYI, I just committed this. The change is in the ValueCompositeType class.
>>>>
>>>> /Rickard
>>>>
>>>> _______________________________________________
>>>> qi4j-dev mailing list
>>>> [email protected]
>>>> http://lists.ops4j.org/mailman/listinfo/qi4j-dev
>>>
>>
>
_______________________________________________
qi4j-dev mailing list
[email protected]
http://lists.ops4j.org/mailman/listinfo/qi4j-dev