1 28 29 package com.caucho.el; 30 31 import com.caucho.vfs.WriteStream; 32 33 import javax.el.ELContext; 34 import javax.el.ELException; 35 import java.io.IOException ; 36 37 40 public class BooleanLiteral extends AbstractBooleanExpr { 41 private boolean _value; 42 43 48 public BooleanLiteral(boolean value) 49 { 50 _value = value; 51 } 52 53 56 public boolean isConstant() 57 { 58 return true; 59 } 60 61 68 @Override 69 public boolean evalBoolean(ELContext env) 70 throws ELException 71 { 72 return _value; 73 } 74 75 80 public void printCreate(WriteStream os) 81 throws IOException 82 { 83 os.print("new com.caucho.el.BooleanLiteral("); 84 os.print(_value); 85 os.print(")"); 86 } 87 88 91 public boolean equals(Object o) 92 { 93 if (! (o instanceof BooleanLiteral)) 94 return false; 95 96 BooleanLiteral literal = (BooleanLiteral) o; 97 98 return _value == literal._value; 99 } 100 101 104 public String toString() 105 { 106 return String.valueOf(_value); 107 } 108 } 109 | Popular Tags |