1 package org.apache.velocity.runtime.parser.node; 2 17 18 import org.apache.velocity.util.introspection.Introspector; 19 20 import org.apache.velocity.runtime.RuntimeLogger; 21 22 35 public class BooleanPropertyExecutor extends PropertyExecutor 36 { 37 public BooleanPropertyExecutor(RuntimeLogger rlog, Introspector is, Class clazz, String property) 38 { 39 super(rlog, is, clazz, property); 40 } 41 42 protected void discover(Class clazz, String property) 43 { 44 try 45 { 46 char c; 47 StringBuffer sb; 48 49 Object [] params = { }; 50 51 54 55 sb = new StringBuffer ("is"); 56 sb.append(property); 57 58 c = sb.charAt(2); 59 60 if (Character.isLowerCase(c)) 61 { 62 sb.setCharAt(2, Character.toUpperCase(c)); 63 } 64 65 methodUsed = sb.toString(); 66 method = introspector.getMethod(clazz, methodUsed, params); 67 68 if (method != null) 69 { 70 73 74 if (method.getReturnType() == Boolean.TYPE) 75 return; 76 77 method = null; 78 } 79 } 80 catch(Exception e) 81 { 82 rlog.error("PROGRAMMER ERROR : BooleanPropertyExector() : " + e); 83 } 84 } 85 } 86 | Popular Tags |