1 | package sh.okx.rankup.text.pebble; | |
2 | ||
3 | import com.mitchellbosecke.pebble.error.PebbleException; | |
4 | import com.mitchellbosecke.pebble.extension.Filter; | |
5 | import com.mitchellbosecke.pebble.template.EvaluationContext; | |
6 | import com.mitchellbosecke.pebble.template.PebbleTemplate; | |
7 | import java.text.DecimalFormat; | |
8 | import java.util.List; | |
9 | import java.util.Map; | |
10 | ||
11 | public class DecimalFormatFilter implements Filter { | |
12 | ||
13 | private final DecimalFormat format; | |
14 | ||
15 | public DecimalFormatFilter(DecimalFormat format) { | |
16 | this.format = format; | |
17 | } | |
18 | ||
19 | @Override | |
20 | public List<String> getArgumentNames() { | |
21 |
1
1. getArgumentNames : replaced return value with Collections.emptyList for sh/okx/rankup/text/pebble/DecimalFormatFilter::getArgumentNames → SURVIVED |
return null; |
22 | } | |
23 | ||
24 | @Override | |
25 | public Object apply(Object input, Map<String, Object> args, PebbleTemplate self, | |
26 | EvaluationContext context, int lineNumber) throws PebbleException { | |
27 |
1
1. apply : negated conditional → KILLED |
if (input == null) { |
28 | return null; | |
29 | } | |
30 |
1
1. apply : negated conditional → KILLED |
if (!(input instanceof Number)) { |
31 | throw new PebbleException(null, "The input for the 'DecimalFormatFilter' filter has to be a number: " + input, | |
32 | lineNumber, self.getName()); | |
33 | } | |
34 | ||
35 | Number number = (Number) input; | |
36 |
1
1. apply : replaced return value with null for sh/okx/rankup/text/pebble/DecimalFormatFilter::apply → KILLED |
return this.format.format(number); |
37 | } | |
38 | } | |
Mutations | ||
21 |
1.1 |
|
27 |
1.1 |
|
30 |
1.1 |
|
36 |
1.1 |