Dears,
I did a tiny hivemind service to retrieve that yields a Format object to output
currency values.
Now, I tried to do this in my html source:
<span
jwcid="@Insert"
value="ognl:valueAsABigDecimal"
format="service-property:application.NumberFormat:euro"
>...</span>
The problem is that I get a "No type converter for type java.text.Format is
available" when the span is rendered. The service's constructor is not even
invoked.
This is the class implementing the application.NumberFormat service:
public class NumberFormatSingleton implements ServiceImplementationFactory {
private static final class CoreService {
private ThreadLocale threadLocale;
public DecimalFormat getNumber()
{
return((DecimalFormat)NumberFormat.getInstance(threadLocale.getLocale())); }
public Format getEuro() {
DecimalFormat fmt = getNumber();
fmt.setDecimalSeparatorAlwaysShown(true);
fmt.setMaximumFractionDigits(2);
fmt.setMinimumFractionDigits(2);
return(fmt);
}
public CoreService(ThreadLocale threadLocale)
{ this.threadLocale = threadLocale; }
}
public Object
createCoreServiceImplementation(ServiceImplementationFactoryParameters arg0) {
return(
new CoreService(
((NumberFormatSingletonParameters)arg0.getFirstParameter()).getThreadLocale()
)
);
}
}
and this is the service-point defining the service into the registry:
<service-point id="NumberFormat"
interface="org.apache.hivemind.ServiceImplementationFactory"
>
<parameters-schema>
<element name="construct">
<attribute name="thread-locale"
required="true"/>
<conversion
class="NumberFormatSingletonParameters">
<map attribute="thread-locale"
property="threadLocale" />
</conversion>
</element>
</parameters-schema>
<invoke-factory>
<construct class="NumberFormatSingleton">
<set-service property="threadLocale"
service-id="hivemind.ThreadLocale"/>
</construct>
</invoke-factory>
</service-point>
What's wrong?
Regards,
-----------------------------------
Giampaolo Tomassoni - IT Consultant
Piazza VIII Aprile 1948, 4
I-53044 Chiusi (SI) - Italy
Ph: +39-0578-21100
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]