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 BooleanValueExpression extends AbstractValueExpression 43 { 44 protected static final Logger log 45 = Logger.getLogger(BooleanValueExpression.class.getName()); 46 protected static final L10N L = new L10N(BooleanValueExpression.class); 47 48 private Class _expectedType; 49 50 public BooleanValueExpression(Expr expr, 51 String expressionString, 52 Class expectedType) 53 { 54 super(expr, expressionString); 55 56 _expectedType = expectedType; 57 } 58 59 public BooleanValueExpression(Expr expr, 60 String expressionString) 61 { 62 super(expr, expressionString); 63 } 64 65 public BooleanValueExpression(Expr expr) 66 { 67 super(expr); 68 } 69 70 @Override 71 public Class <?> getExpectedType() 72 { 73 if (_expectedType != null) 74 return _expectedType; 75 else 76 return Boolean .class; 77 } 78 79 @Override 80 public Object getValue(ELContext context) 81 throws PropertyNotFoundException, 82 ELException 83 { 84 return new Boolean (_expr.evalBoolean(context)); 85 } 86 } 87 | Popular Tags |