final public ListLiteral ListLiteral() throws ParseException {ArrayList values = new ArrayList(); Token begin, end; begin = jj_consume_token(OPEN_BRACKET); values = PositionalArgs(); end = jj_consume_token(CLOSE_BRACKET); ListLiteral result = new ListLiteral(values); result.setLocation(template, begin, end); {if ("" != null) return result;} throw new Error("Missing return statement in function"); }
@Override public String getCanonicalForm() { StringBuilder buf = new StringBuilder(); buf.append(target.getCanonicalForm()); buf.append("("); String list = arguments.getCanonicalForm(); buf.append(list.substring(1, list.length() - 1)); buf.append(")"); return buf.toString(); }
@Override ParameterRole getParameterRole(int idx) { checkIndex(idx); return ParameterRole.ITEM_VALUE; }
List argumentStrings = targetMethod instanceof TemplateMethodModelEx ? arguments.getModelList(env) : arguments.getValueList(env); Object result = targetMethod.exec(argumentStrings); return env.getObjectWrapper().wrap(result);
MethodCall(Expression target, ArrayList arguments) { this(target, new ListLiteral(arguments)); }
@Override TemplateElement[] accept(Environment env) throws IOException, TemplateException { TemplateModel node = targetNode.eval(env); if (!(node instanceof TemplateNodeModel)) { throw new NonNodeException(targetNode, node, env); } TemplateModel nss = namespaces == null ? null : namespaces.eval(env); if (namespaces instanceof StringLiteral) { nss = env.importLib(((TemplateScalarModel) nss).getAsString(), null); } else if (namespaces instanceof ListLiteral) { nss = ((ListLiteral) namespaces).evaluateStringsToNamespaces(env); } if (nss != null) { if (nss instanceof Environment.Namespace) { SimpleSequence ss = new SimpleSequence(1); ss.add(nss); nss = ss; } else if (!(nss instanceof TemplateSequenceModel)) { if (namespaces != null) { throw new NonSequenceException(namespaces, nss, env); } else { // Should not occur throw new _MiscTemplateException(env, "Expecting a sequence of namespaces after \"using\""); } } } env.invokeNodeHandlerFor((TemplateNodeModel) node, (TemplateSequenceModel) nss); return null; }
@Override protected Expression deepCloneWithIdentifierReplaced_inner( String replacedIdentifier, Expression replacement, ReplacemenetState replacementState) { return new MethodCall( target.deepCloneWithIdentifierReplaced(replacedIdentifier, replacement, replacementState), (ListLiteral) arguments.deepCloneWithIdentifierReplaced(replacedIdentifier, replacement, replacementState)); }
TemplateSequenceModel evaluateStringsToNamespaces(Environment env) throws TemplateException { TemplateSequenceModel val = (TemplateSequenceModel) eval(env); SimpleSequence result = new SimpleSequence(val.size()); for (int i = 0; i < items.size(); i++) { Object itemExpr = items.get(i); if (itemExpr instanceof StringLiteral) { String s = ((StringLiteral) itemExpr).getAsString(); try { Environment.Namespace ns = env.importLib(s, null); result.add(ns); } catch (IOException ioe) { throw new _MiscTemplateException(((StringLiteral) itemExpr), "Couldn't import library ", new _DelayedJQuote(s), ": ", new _DelayedGetMessage(ioe)); } } else { result.add(val.get(i)); } } return result; }
List argumentStrings = targetMethod instanceof TemplateMethodModelEx ? arguments.getModelList(env) : arguments.getValueList(env); Object result = targetMethod.exec(argumentStrings); return env.getObjectWrapper().wrap(result);
@Override protected Expression deepCloneWithIdentifierReplaced_inner( String replacedIdentifier, Expression replacement, ReplacemenetState replacementState) { ArrayList clonedValues = (ArrayList) items.clone(); for (ListIterator iter = clonedValues.listIterator(); iter.hasNext(); ) { iter.set(((Expression) iter.next()).deepCloneWithIdentifierReplaced( replacedIdentifier, replacement, replacementState)); } return new ListLiteral(clonedValues); }
nss = env.importLib(((TemplateScalarModel) nss).getAsString(), null); } else if (namespaces instanceof ListLiteral) { nss = ((ListLiteral) namespaces).evaluateStringsToNamespaces(env);
@Override protected Expression deepCloneWithIdentifierReplaced_inner( String replacedIdentifier, Expression replacement, ReplacemenetState replacementState) { return new MethodCall( target.deepCloneWithIdentifierReplaced(replacedIdentifier, replacement, replacementState), (ListLiteral) arguments.deepCloneWithIdentifierReplaced(replacedIdentifier, replacement, replacementState)); }
TemplateSequenceModel evaluateStringsToNamespaces(Environment env) throws TemplateException { TemplateSequenceModel val = (TemplateSequenceModel) eval(env); SimpleSequence result = new SimpleSequence(val.size()); for (int i = 0; i < items.size(); i++) { Object itemExpr = items.get(i); if (itemExpr instanceof StringLiteral) { String s = ((StringLiteral) itemExpr).getAsString(); try { Environment.Namespace ns = env.importLib(s, null); result.add(ns); } catch (IOException ioe) { throw new _MiscTemplateException(((StringLiteral) itemExpr), "Couldn't import library ", new _DelayedJQuote(s), ": ", new _DelayedGetMessage(ioe)); } } else { result.add(val.get(i)); } } return result; }
final public ListLiteral ListLiteral() throws ParseException {ArrayList values = new ArrayList(); Token begin, end; begin = jj_consume_token(OPEN_BRACKET); values = PositionalArgs(); end = jj_consume_token(CLOSE_BRACKET); ListLiteral result = new ListLiteral(values); result.setLocation(template, begin, end); {if ("" != null) return result;} throw new Error("Missing return statement in function"); }
List argumentStrings = targetMethod instanceof TemplateMethodModelEx ? arguments.getModelList(env) : arguments.getValueList(env); Object result = targetMethod.exec(argumentStrings); return env.getObjectWrapper().wrap(result);
MethodCall(Expression target, ArrayList arguments) { this(target, new ListLiteral(arguments)); }
void accept(Environment env) throws IOException, TemplateException { TemplateModel node = targetNode == null ? null : targetNode.getAsTemplateModel(env); TemplateModel nss = namespaces == null ? null : namespaces.getAsTemplateModel(env); if (namespaces instanceof StringLiteral) { nss = env.importLib(((TemplateScalarModel) nss).getAsString(), null); } else if (namespaces instanceof ListLiteral) { nss = ((ListLiteral) namespaces).evaluateStringsToNamespaces(env); } if (node != null && !(node instanceof TemplateNodeModel)) { throw new TemplateException("Expecting an XML node here, for expression: " + targetNode + ", found a: " + node.getClass().getName(), env); } if (nss != null) { if (nss instanceof TemplateHashModel) { SimpleSequence ss = new SimpleSequence(1); ss.add(nss); nss = ss; } else if (!(nss instanceof TemplateSequenceModel)) { throw new TemplateException("Expecting a sequence of namespaces after 'using'", env); } } env.recurse((TemplateNodeModel) node, (TemplateSequenceModel) nss); }
public String getCanonicalForm() { StringBuffer buf = new StringBuffer(); buf.append(target.getCanonicalForm()); buf.append("("); String list = arguments.getCanonicalForm(); buf.append(list.substring(1, list.length() -1)); buf.append(")"); return buf.toString(); }
@Override Object getParameterValue(int idx) { checkIndex(idx); return items.get(idx); }
@Override protected Expression deepCloneWithIdentifierReplaced_inner( String replacedIdentifier, Expression replacement, ReplacemenetState replacementState) { return new MethodCall( target.deepCloneWithIdentifierReplaced(replacedIdentifier, replacement, replacementState), (ListLiteral) arguments.deepCloneWithIdentifierReplaced(replacedIdentifier, replacement, replacementState)); }