1 package org.jicengine.element.impl; 2 3 import org.jicengine.operation.OperationException; 4 import org.jicengine.operation.Context; 5 import org.jicengine.operation.Operation; 6 import org.jicengine.element.*; 7 8 19 20 public class BeanElementCompiler extends ElementCompiler { 21 22 public BeanElementCompiler(String name, Location location) 23 { 24 super(name, location); 25 } 26 27 30 protected ActionElement handleLooseVariableElement(final VariableElement child) throws ElementException 31 { 32 if( this.getElement().getConstructor() == null){ 33 throw new ElementException("Unused child element: <" + child.getName() + ">", getName(), getLocation()); 37 } 38 try { 39 Operation setPropertyAction = org.jicengine.expression.LJEParser.getInstance().parse(getSetPropertyActionExpression(child.getName()) ); 40 41 return new WrapperActionElement(child, child.getLocation(), setPropertyAction); 42 43 } catch (org.jicengine.expression.SyntaxException e){ 44 throw new ElementException(e,getName(), getLocation()); 45 } 46 } 47 48 51 public static String getSetPropertyActionExpression(String propertyName) 52 { 53 return Element.VARIABLE_NAME_PARENT_INSTANCE + ".set" + Character.toUpperCase(propertyName.charAt(0)) + propertyName.substring(1) + "(" + Element.VARIABLE_NAME_ELEMENT_INSTANCE + ")"; 54 } 55 } 56 | Popular Tags |