1 package org.jicengine.expression; 2 3 import org.jicengine.operation.*; 4 import org.jicengine.element.impl.FactoryElementCompiler; 5 16 public class FactoryInvocationParser implements Parser { 17 18 public static final String FACTORY_NAME_PREFIX = "jic::"; 19 20 private Parser argumentsParser; 21 22 public FactoryInvocationParser(Parser argumentsParser) 23 { 24 this.argumentsParser = argumentsParser; 25 } 26 27 30 public Operation parse(String expression) throws SyntaxException 31 { 32 if( expression.startsWith(FACTORY_NAME_PREFIX) ){ 33 int parameterStart = expression.indexOf(InvocationParser.METHOD_PARAMS_START); 35 int parameterEnd = expression.indexOf(InvocationParser.METHOD_PARAMS_END); 36 37 String factoryName = expression.substring(0,parameterStart); 38 String argumentsExpression = expression.substring(parameterStart+1,parameterEnd); 39 40 Operation[] arguments = InvocationParser.parseArguments(this.argumentsParser, argumentsExpression); 41 42 return new FactoryInvocationOperation(factoryName, arguments); 43 } 44 else { 45 return null; 46 } 47 } 48 49 } 50 | Popular Tags |