1 55 56 package org.apache.commons.el; 57 58 import javax.servlet.jsp.el.ELException ; 59 60 67 68 public class OrOperator 69 extends BinaryOperator 70 { 71 75 public static final OrOperator SINGLETON = 76 new OrOperator (); 77 78 83 public OrOperator () 84 { 85 } 86 87 94 public String getOperatorSymbol () 95 { 96 return "or"; 97 } 98 99 104 public Object apply (Object pLeft, 105 Object pRight, 106 Logger pLogger) 107 throws ELException 108 { 109 boolean left = 111 Coercions.coerceToBoolean (pLeft, pLogger).booleanValue (); 112 boolean right = 113 Coercions.coerceToBoolean (pRight, pLogger).booleanValue (); 114 115 return PrimitiveObjects.getBoolean (left || right); 116 } 117 118 124 public boolean shouldEvaluate (Object pLeft) 125 { 126 return 127 (pLeft instanceof Boolean ) && 128 ((Boolean ) pLeft).booleanValue () == false; 129 } 130 131 137 public boolean shouldCoerceToBoolean () 138 { 139 return true; 140 } 141 142 } 144 | Popular Tags |