RE: DDR Simple API - PropertyValue and Enumerations

Hello José,

 

Thank you for your comment. We have recorded this comment as “LC-1954” and we will respond as soon as possible.

 

On behalf of DDWG,

Rotan Hanrahan

Chair

 

From: public-ddwg-comments-request@w3.org [mailto:public-ddwg-comments-request@w3.org] On Behalf Of JOSE MANUEL CANTERA FONSECA
Sent: 15 April 2008 10:26
To: public-ddwg-comments@w3.org
Subject: DDR Simple API - PropertyValue and Enumerations

 

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 10:08:52 UTC