I will reply to myself... please tell me if there is a better way!

public final class X implements Y {
 public static final Y CONSTANT= new X();

 private X() {
 }

 public Y factory() {
  return CONSTANT;
 }
 ...
}

Then in the Blueprint:
<bean id="constant" class="X" factory-method="factory"/>

<bean class="Z">
 <argument ref="constant"/>
 ...
</bean>

Nice Blueprint stuff :)

Quoting Jean-Philippe Clement <[email protected]>:

Hello, I would like to use Java constants (static final) in Blueprint
configuration files.

Let's say I have the following Java:
public final class X implements Y {
 public static final Y CONSTANT= new X();

 private X() {
 }
 ...
}

And:
public final class Z {
 public Z(final Y y) {
 ...
 }
 ...
}

How may I use this constant? Is this syntax correct...else?:
<bean class="Z">
 <argument value="X.CONSTANT"/>
 ...
</bean>

Thanks!




---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]




---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to