Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 package org.richfaces.component.behavior;
 
 import java.util.List;
 
 import  org.ajax4jsf.javascript.ScriptStringBase;
 
public class AnonymousFunctionCall extends ScriptStringBase {
    private StringBuffer body = new StringBuffer();
    private List<ObjectparameterNames = new ArrayList<Object>();
    private List<ObjectparameterValues = new ArrayList<Object>();
    public AnonymousFunctionCall(Object... parameterNames) {
        this..addAll(Arrays.asList(parameterNames));
    }
    @Override
    public void appendScript(Appendable targetthrows IOException {
        target.append(LEFT_ROUND_BRACKET).append(FUNCTION).append(LEFT_ROUND_BRACKET);
        boolean first = true;
        for (Object element : ) {
            if (!first) {
                target.append(COMMA);
            }
            target.append(element.toString());
            first = false;
        }
        target.append(RIGHT_ROUND_BRACKET).append(LEFT_CURLY_BRACKET).append().append(RIGHT_CURLY_BRACKET)
                .append(RIGHT_ROUND_BRACKET).append(LEFT_ROUND_BRACKET);
        first = true;
        for (Object element : ) {
            if (!first) {
                target.append(COMMA);
            }
            target.append(element.toString());
            first = false;
        }
        target.append(RIGHT_ROUND_BRACKET);
    }
    public AnonymousFunctionCall addParameterName(Object... param) {
        .addAll(Arrays.asList(param));
        return this;
    }
    public AnonymousFunctionCall addParameterValue(Object... param) {
        .addAll(Arrays.asList(param));
        return this;
    }
    public AnonymousFunctionCall addToBody(Object body) {
        this..append(body);
        return this;
    }
New to GrepCode? Check out our FAQ X