W3C home > Mailing lists > Public > public-ddwg@w3.org > November 2007

RE: [API] Code snippet I .- fast property retrieval (not unit aware)

From: Rotan Hanrahan <rotan.hanrahan@mobileaware.com>
Date: Mon, 19 Nov 2007 23:22:24 -0000
Message-ID: <D5306DC72D165F488F56A9E43F2045D39C6B42@FTO.mobileaware.com>
To: "JOSE MANUEL CANTERA FONSECA" <jmcf@tid.es>, <public-ddwg@w3.org>

+1 to the proposal to have a toString() method in the property value class. We should also require that if two property value object represent different values (i.e. they are not equal) then their toString() methods should also return strings that are not equal.
 
I think the values returned should be boxed types. We should be able to make a reasonable assuption that the developer will know what return type is appropriate. I also think that helping the developer during compile time is useful, so appropriate typing that can be tested during implementation/compilation would be useful.
 
The "fast food" version is starting to look good.
 
---R

________________________________

From: public-ddwg-request@w3.org on behalf of JOSE MANUEL CANTERA FONSECA
Sent: Mon 19/11/2007 23:12
To: public-ddwg@w3.org
Subject: [API] Code snippet I .- fast property retrieval (not unit aware)



Hi,

Here a start a series of code snippets trying to center the discussion
on the DDRPropertyValue object and its methods. The most simple property
retrieval is the so-called fast food version. Here is an example

DDRPropertyValue value = ddr.getPropertyValue("resolution_width",key);
System.out.println("Retrieved value:" + value.getValue());

So here comes the first question:

Now the DDRPropertyValue has a getValue method that returns an Object.
Do we want it to be as generic as an object or do we want specific
methods such as

getBoolean()
getInteger()
getDouble()
getString()

???

Also from my example it seems to be good (at least in Java) to have an
implemented toString() method at the level of DDRPropertyValue that will
return the property value as an String, simplifying even more the task
for the developer, that will print the value with
System.out.println(value) where value is a DDRPropertyValue object. That
toString() method will actually call the getString() method.

Best Regards

----
José Manuel Cantera Fonseca
Telefónica I+D
Received on Monday, 19 November 2007 23:22:36 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Sunday, 6 December 2009 12:13:51 GMT