A builder usually returns itself to cumulates changes via Java. It could be 
good to use the same method either from Java or Blueprint. From a language 
perspective there is nothing which prevents this as a method is identified via 
its name and arguments; it is not tied to its return type.

Is the return type really prohibited from the Blueprint spec or is it left 
unspecified?

JP


-----Message d'origine-----
De : Jean-Baptiste Onofré [mailto:[email protected]] 
Envoyé : lundi 23 juin 2014 17:49
À : [email protected]
Objet : Re: Troubles when creating a builder with blueprint.

Hi Christophe,

in JavaBeans (following by Blueprint), a setter is void, and a getter doesn't 
have argument.
So it should be:

public void setMaxValue(float maxValue) {
    this.maxValue=maxValue;
}
public float getMaxValue() {
    return this.maxValue;
}

Regards
JB

On 06/23/2014 05:34 PM, Lasserre Christophe wrote:
> Hello,
>
> I wrote a builder containing the following setter which does not 
> return void (see following sample).
>
>      /**
>
>       * @param maxValue
>
>       *            Maximal value for compression law attributes
>
>       * @return the builder.
>
>       */
>
>      public CompressionLawBuilder setMaxValue(final float maxValue) {
>
>          this.maxValue = maxValue;
>
>          return this;
>
> }
>
> When I try to create the builder via blueprint, the runtime returns me
> the following error message;            "Caused by:
> org.osgi.service.blueprint.container.ComponentDefinitionException: No 
> setter for maxValue property"
>
> If I change the setter and make it return void, everything works 
> perfectly, so is it normal that the return type of the setter has an 
> impact on the application behavior ?
>
> Chris.
>
> [@@ OPEN @@]
>

--
Jean-Baptiste Onofré
[email protected]
http://blog.nanthrax.net
Talend - http://www.talend.com

Reply via email to