W3C home > Mailing lists > Public > public-ddwg-comments@w3.org > April 2008

DDR Simple API - PropertyValue and Enumerations

Date: Tue, 15 Apr 2008 11:26:25 +0200
To: "public-ddwg-comments@w3.org" <public-ddwg-comments@w3.org>
Message-id: <93AA9E47B82F684A868C217766F489050397FB9ECE@EXCLU2K7.hi.inet>
The PropertyValue interface publishes the method "getEnumeration()" to deal with property values that are an enumeration of several values, such as image formats. If a content adaptation solution needs to check if a Delivery Context supports "gif" it will need to do the following:

PropertyValue val = service.getPropertyValue(evidence,"supportedImageFormats");

String[] imageFormats = val.getEnumeration();

gifSupported = false;

for(int j = 0; j < imageFormats.length; j++) {
    if(imageFormats[j].equals("gif")) {
       gifSupported = true;

As it is seen this is a very inconvenient way to do a more than common  operation. Also it will force develoeprs to copy & paste this code over all the applications

Proposed Amendment:

+ Add a contains method on the PropertyValue interface that returns true or false depending on the values of the enumeration

boolean gifSupported = service.getPropertyValue(evidence,"supportedImageFormats").contains("gif");

José Manuel Cantera
Senior Technologist
Telefónica I+D
Received on Tuesday, 15 April 2008 09:26:34 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 19:30:53 UTC