MCPcopy Create free account
hub / github.com/apache/tomcat / getValue

Method getValue

java/org/apache/el/parser/AstNegative.java:38–77  ·  view source on GitHub ↗
(EvaluationContext ctx)

Source from the content-addressed store, hash-verified

36 }
37
38 @Override
39 public Object getValue(EvaluationContext ctx) throws ELException {
40 Object obj = this.children[0].getValue(ctx);
41
42 if (obj == null) {
43 return Long.valueOf(0);
44 }
45 if (obj instanceof BigDecimal) {
46 return ((BigDecimal) obj).negate();
47 }
48 if (obj instanceof BigInteger) {
49 return ((BigInteger) obj).negate();
50 }
51 if (obj instanceof String) {
52 if (ELSupport.isStringFloat((String) obj)) {
53 return Double.valueOf(-Double.parseDouble((String) obj));
54 }
55 return Long.valueOf(-Long.parseLong((String) obj));
56 }
57 if (obj instanceof Long) {
58 return Long.valueOf(-((Long) obj).longValue());
59 }
60 if (obj instanceof Double) {
61 return Double.valueOf(-((Double) obj).doubleValue());
62 }
63 if (obj instanceof Integer) {
64 return Integer.valueOf(-((Integer) obj).intValue());
65 }
66 if (obj instanceof Float) {
67 return Float.valueOf(-((Float) obj).floatValue());
68 }
69 if (obj instanceof Short) {
70 return Short.valueOf((short) -((Short) obj).shortValue());
71 }
72 if (obj instanceof Byte) {
73 return Byte.valueOf((byte) -((Byte) obj).byteValue());
74 }
75 Long num = (Long) ELSupport.coerceToNumber(ctx, obj, Long.class);
76 return Long.valueOf(-num.longValue());
77 }
78}

Callers

nothing calls this directly

Calls 5

isStringFloatMethod · 0.95
coerceToNumberMethod · 0.95
getValueMethod · 0.65
valueOfMethod · 0.45
parseLongMethod · 0.45

Tested by

no test coverage detected