List of usage examples for org.apache.commons.lang.text StrBuilder charAt
public char charAt(int index)
From source file:bboss.org.apache.velocity.runtime.parser.node.SetPropertyExecutor.java
/** * @param clazz//from w ww. java 2s. c o m * @param property * @param arg */ protected void discover(final Class clazz, final String property, final Object arg) { Object[] params = new Object[] { arg }; try { StrBuilder sb = new StrBuilder("set"); sb.append(property); setMethod(introspector.getMethod(clazz, sb.toString(), params)); if (!isAlive()) { /* * now the convenience, flip the 1st character */ char c = sb.charAt(3); if (Character.isLowerCase(c)) { sb.setCharAt(3, Character.toUpperCase(c)); } else { sb.setCharAt(3, Character.toLowerCase(c)); } setMethod(introspector.getMethod(clazz, sb.toString(), params)); } } /** * pass through application level runtime exceptions */ catch (RuntimeException e) { throw e; } catch (Exception e) { String msg = "Exception while looking for property setter for '" + property; log.error(msg, e); throw new VelocityException(msg, e); } }
From source file:org.apache.velocity.runtime.parser.node.SetPropertyExecutor.java
/** * @param clazz/*from w w w.ja v a 2 s. com*/ * @param property * @param arg */ protected void discover(final Class clazz, final String property, final Object arg) { Object[] params = new Object[] { arg }; try { StrBuilder sb = new StrBuilder("set"); sb.append(property); setMethod(introspector.getMethod(clazz, sb.toString(), params)); if (!isAlive()) { /* * now the convenience, flip the 1st character */ char c = sb.charAt(3); if (Character.isLowerCase(c)) { sb.setCharAt(3, Character.toUpperCase(c)); } else { sb.setCharAt(3, Character.toLowerCase(c)); } setMethod(introspector.getMethod(clazz, sb.toString(), params)); } } /** * pass through application level runtime exceptions */ catch (RuntimeException e) { throw e; } catch (Exception e) { String msg = "Exception while looking for property setter for '" + property; Logger.error(this, msg, e); throw new VelocityException(msg, e); } }