You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@felix.apache.org by "Clement Escoffier (JIRA)" <ji...@apache.org> on 2010/04/12 08:29:40 UTC
[jira] Resolved: (FELIX-2268) Simplify setting of properties.
[ https://issues.apache.org/jira/browse/FELIX-2268?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Clement Escoffier resolved FELIX-2268.
--------------------------------------
Assignee: Clement Escoffier
Fix Version/s: iPOJO-1.6.0
Resolution: Fixed
Commit the patch with a couple of changes.
First, The ComponentType has now a addProperty(String k, Object v) method adding a configuration property to the current component type.
Service has also a similar method (addProperty(String k, Object v)) adding a service property to the current service.
Thanks !
> 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
> Assignee: Clement Escoffier
> Fix For: iPOJO-1.6.0
>
>
> From: Clement Escoffier [mailto: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;
> }
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira