1 package com.icesoft.faces.el; 2 3 import javax.faces.el.MethodBinding; 4 import javax.faces.el.EvaluationException; 5 import javax.faces.el.MethodNotFoundException; 6 import javax.faces.context.FacesContext; 7 import java.io.Serializable ; 8 9 19 public class LiteralBooleanMethodBinding 20 extends MethodBinding 21 implements Serializable 22 { 23 private String svalue; 24 private Boolean value; 25 26 public LiteralBooleanMethodBinding(String svalue) { 27 this.svalue = svalue; 28 this.value = resolve(svalue); 29 } 30 31 public Object invoke(FacesContext facesContext, Object [] objects) 32 throws EvaluationException, MethodNotFoundException 33 { 34 return value; 35 } 36 37 public Class getType(FacesContext facesContext) 38 throws MethodNotFoundException 39 { 40 return Boolean .class; 41 } 42 43 public String getExpressionString() { 44 return svalue; 45 } 46 47 private static Boolean resolve(String value) { 48 Boolean ret = Boolean.FALSE; 49 if( value != null ) { 50 try { 51 ret = Boolean.valueOf(value); 52 } 53 catch(Exception e) {} } 55 return ret; 56 } 57 } 58 | Popular Tags |