What steps will reproduce the problem?
1. Annotate getter method using the @FixedFormatNumber(sign=Sign.PREPEND,
positiveSign='0')
What is the expected output? What do you see instead?
You would expect the output from the formatter to use '0' as positive sign.
0000100 for positive 100 and -000100 for -100
What version of the product are you using? On what Java version?
Please provide any additional information below.
Sign.PREPEND should use FixedFormatNumberData.positive sign and not '+'. A
propesed solution would be:
PREPEND {
public String apply(String value, FormatInstructions instructions) {
String sign = StringUtils.substring(value, 0, 1);
if ("-".equals(sign)) {
value = StringUtils.substring(value, 1);
sign = instructions.getFixedFormatNumberData().getNegativeSign().toString();
} else {
sign = instructions.getFixedFormatNumberData().getPositiveSign().toString();
}
String result = instructions.getAlignment().apply(value, instructions.getLength(), instructions.getPaddingChar());
return sign + StringUtils.substring(result, 1);
}
Original issue reported on code.google.com by par.wena...@gmail.com on 29 Mar 2012 at 11:56
Original issue reported on code.google.com by
par.wena...@gmail.com
on 29 Mar 2012 at 11:56