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

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

From: JOSE MANUEL CANTERA FONSECA <jmcf@tid.es>
Date: Tue, 20 Nov 2007 00:12:18 +0100
To: public-ddwg@w3.org
Message-id: <fa61d264eb2.eb2fa61d264@tid.es>
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:12:57 GMT

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