Details
-
Improvement
-
Status: Closed
-
Major
-
Resolution: Fixed
-
None
-
None
Description
From: Clement Escoffier clement.escoffier@gmail.com
Sent: 09 April 2010 16:49
To: peter lawrey
Subject: Re: It is interesting...
Hi,
On 09.04.2010, at 11:46, peter lawrey wrote:
"This API was designed to be easy to use, avoids redundancies..."
addProperty(
new ServiceProperty().setName("language")
.setType(String.class.getName())
.setValue("en")
)
Perhaps you could simplify this with a method which takes a plain key/value pair. e.g. Properties.setProperty(String, String);
Like
addProperty("language","en")
You could implement this using a helper method.
public PrimitiveComponentType addProperty(String key, Object obj) {
Class clazz = obj == null ? String.class : obj.getClass();
addProperty(new ServiceProperty().setName(key)
.setType(clazz.getName())
.setValue(obj) ;
return this;
}