Exemple #1
0
  protected void parseParamStrings(String paramString, ExpressionFactory expressionFactory) {
    List paramStrings = Util.tokenizeIgnoringEnclosers(paramString, ',');
    for (Iterator itr = paramStrings.iterator(); itr.hasNext(); ) {
      String nextParam = ((String) itr.next()).trim();
      if (!(nextParam.equals(""))) {
        Debug.logn("Find match for param " + nextParam, this);
        if (CallExpression.isVariable(this.context, nextParam)) {
          DNVariable v = CallExpression.getVariable(this.context, nextParam);
          parameters.add(v);
        } else if (expressionFactory.getExpression(nextParam, this.context) != null) {

          parameters.add(expressionFactory.getExpression(nextParam, this.context));
        }
      }
    }
  }
Exemple #2
0
 public String paramsAsJava() {
   String s = "";
   for (Iterator itr = this.parameters.iterator(); itr.hasNext(); ) {
     Object o = itr.next();
     if (o instanceof DNVariable) {
       DNVariable var = (DNVariable) o;
       s = s + var.getName();
     } else if (o instanceof Expression) {
       s = s + ((Expression) o).asJava();
     } else {
       throw new RuntimeException("Something funny in the params " + parameters);
     }
     if (itr.hasNext()) {
       s = s + ", ";
     }
   }
   return s;
 }
Exemple #3
0
 private static List createVBArrayCreationDeclatationsAndSubstituteParams(
     List oldParameters, List newParameters, InterpretationContext context) {
   List arrayCreationDeclarations = new ArrayList();
   String s = ACE_VARIABLE_NAME;
   for (Iterator itr = oldParameters.iterator(); itr.hasNext(); ) {
     Object o = itr.next();
     if (o instanceof ArrayCreationExpression) {
       ArrayCreationExpression ace = (ArrayCreationExpression) o;
       LocalVariableDeclaration ds =
           LocalVariableDeclaration.createVBLocalVariableDeclaration(context, ace, s + aceCounter);
       arrayCreationDeclarations.add(ds);
       newParameters.add(DNVariable.createVBVariable(s + aceCounter, ace.getName() + "()"));
       aceCounter++;
     } else {
       newParameters.add(o);
     }
   }
   return arrayCreationDeclarations;
 }