public static final Number divide(final Object obj0, final Object obj1) { if (obj0 == null && obj1 == null) { return ZERO; } final ELArithmetic delegate; if (BIGDECIMAL.matches(obj0, obj1)) delegate = BIGDECIMAL; else if (BIGINTEGER.matches(obj0, obj1)) delegate = BIGDECIMAL; else delegate = DOUBLE; Number num0 = delegate.coerce(obj0); Number num1 = delegate.coerce(obj1); return delegate.divide(num0, num1); }
@Override public void mapFunction(String prefix, String localName, Method method) { if (this.memento == null) { this.memento = new FunctionMapperImpl(); } memento.mapFunction(prefix, localName, method); }
private Node getNode() throws ELException { if (this.node == null) { this.node = ExpressionBuilder.createNode(this.expr); } return this.node; }
@Override public MethodExpression createMethodExpression(ELContext context, String expression, Class<?> expectedReturnType, Class<?>[] expectedParamTypes) { ExpressionBuilder builder = new ExpressionBuilder(expression, context); return builder.createMethodExpression(expectedReturnType, expectedParamTypes); }
private static boolean isCoercibleFrom(Object src, Class<?> target) { // TODO: This isn't pretty but it works. Significant refactoring would // be required to avoid the exception. try { ELSupport.coerceToType(src, target); } catch (ELException e) { return false; } return true; }
@Override public FunctionMapper getFunctionMapper() { return new FunctionMapperImpl(); }
@Override public boolean matches(Object obj0, Object obj1) { return (obj0 instanceof Double || obj1 instanceof Double || obj0 instanceof Float || obj1 instanceof Float || (obj0 instanceof String && ELSupport .isStringFloat((String) obj0)) || (obj1 instanceof String && ELSupport .isStringFloat((String) obj1))); } }
public static final Number divide(final Object obj0, final Object obj1) { if (obj0 == null && obj1 == null) { return ZERO; } final ELArithmetic delegate; if (BIGDECIMAL.matches(obj0, obj1)) delegate = BIGDECIMAL; else if (BIGINTEGER.matches(obj0, obj1)) delegate = BIGDECIMAL; else delegate = DOUBLE; Number num0 = delegate.coerce(obj0); Number num1 = delegate.coerce(obj1); return delegate.divide(num0, num1); }
private Node getNode() throws ELException { if (this.node == null) { this.node = ExpressionBuilder.createNode(this.expr); } return this.node; }
@Override public void mapFunction(String prefix, String localName, Method method) { if (this.memento == null) { this.memento = new FunctionMapperImpl(); } memento.mapFunction(prefix, localName, method); }
public Object getValue(ELContext context) { if (this.expectedType != null) { return ELSupport.coerceToType(this.value, this.expectedType); } return this.value; }
public boolean matches(Object obj0, Object obj1) { return (obj0 instanceof Double || obj1 instanceof Double || obj0 instanceof Float || obj1 instanceof Float || (obj0 instanceof String && ELSupport .isStringFloat((String) obj0)) || (obj1 instanceof String && ELSupport .isStringFloat((String) obj1))); } }
public static final Number divide(final Object obj0, final Object obj1) { if (obj0 == null && obj1 == null) { return ZERO; } final ELArithmetic delegate; if (BIGDECIMAL.matches(obj0, obj1)) delegate = BIGDECIMAL; else if (BIGINTEGER.matches(obj0, obj1)) delegate = BIGDECIMAL; else delegate = DOUBLE; Number num0 = delegate.coerce(obj0); Number num1 = delegate.coerce(obj1); return delegate.divide(num0, num1); }
private Node getNode() throws ELException { if (this.node == null) { this.node = ExpressionBuilder.createNode(this.expr); } return this.node; }
@Override public Object getValue(ELContext context) { if (this.expectedType != null) { return ELSupport.coerceToType(this.value, this.expectedType); } return this.value; }
public static final Number divide(final Object obj0, final Object obj1) { if (obj0 == null && obj1 == null) { return ZERO; } final ELArithmetic delegate; if (BIGDECIMAL.matches(obj0, obj1)) delegate = BIGDECIMAL; else if (BIGINTEGER.matches(obj0, obj1)) delegate = BIGDECIMAL; else delegate = DOUBLE; Number num0 = delegate.coerce(obj0); Number num1 = delegate.coerce(obj1); return delegate.divide(num0, num1); }
/** * @return * @throws ELException */ private Node getNode() throws ELException { if (this.node == null) { this.node = ExpressionBuilder.createNode(this.expr); } return this.node; }
@Override public Object getValue(ELContext context) { if (this.expectedType != null) { return ELSupport.coerceToType(this.value, this.expectedType); } return this.value; }
public final static Number divide(final Object obj0, final Object obj1) { if (obj0 == null && obj1 == null) { return ZERO; } final ELArithmetic delegate; if (BIGDECIMAL.matches(obj0, obj1)) delegate = BIGDECIMAL; else if (BIGINTEGER.matches(obj0, obj1)) delegate = BIGDECIMAL; else delegate = DOUBLE; Number num0 = delegate.coerce(obj0); Number num1 = delegate.coerce(obj1); return delegate.divide(num0, num1); }
/** * @return * @throws ELException */ private Node getNode() throws ELException { if (this.node == null) { this.node = ExpressionBuilder.createNode(this.expr); } return this.node; }