1 29 30 package com.caucho.el; 31 32 import com.caucho.util.L10N; 33 34 import javax.el.ELContext; 35 import javax.el.ELException; 36 import javax.el.PropertyNotFoundException; 37 import java.util.logging.Logger ; 38 39 42 public class IntegerValueExpression extends AbstractValueExpression 43 { 44 protected static final Logger log 45 = Logger.getLogger(IntegerValueExpression.class.getName()); 46 protected static final L10N L = new L10N(IntegerValueExpression.class); 47 48 private Class _expectedType; 49 50 public IntegerValueExpression(Expr expr, 51 String expressionString, 52 Class expectedType) 53 { 54 super(expr, expressionString); 55 56 _expectedType = expectedType; 57 } 58 59 public IntegerValueExpression(Expr expr, 60 String expressionString) 61 { 62 super(expr, expressionString); 63 } 64 65 public IntegerValueExpression(Expr expr) 66 { 67 super(expr); 68 } 69 70 public Class <?> getExpectedType() 71 { 72 if (_expectedType != null) 73 return _expectedType; 74 else 75 return Integer .class; 76 } 77 78 @Override 79 public Object getValue(ELContext context) 80 throws PropertyNotFoundException, 81 ELException 82 { 83 return new Integer ((int) _expr.evalLong(context)); 84 } 85 } 86 | Popular Tags |