Simplify setting of properties.
-------------------------------
Key: FELIX-2268
URL: https://issues.apache.org/jira/browse/FELIX-2268
Project: Felix
Issue Type: Improvement
Components: iPOJO
Reporter: Peter Lawrey
From: Clement Escoffier [mailto:[email protected]]
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;
}
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.