Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 package com.cantaa.util.wicket.jquery;
 
 
Encapsulation of one JQuery function call

Author(s):
Hans Lesmeister
public class JQSnippet implements JQRenderable {
    private final Object[] parameters;
    private IModel<StringsnippetModel;
    public JQSnippet(String callObject... parameters) {
        Reject.ifNull(call"call is null");
         = Model.of(call);
        this. = parameters;
    }
    public JQSnippet(IModel<StringsnippetModelObject... parameters) {
        this. = parameters;
        Reject.ifNull(snippetModel"snippetModel is null");
        this. = snippetModel;
    }
    public String render() {
        StringBuilder sb = new StringBuilder();
        sb.append(.getObject());
        sb.append("(");
        if ( != null) {
            for (int i = 0; i < .i++) {
                Object parameter = [i];
                if (i > 0) {
                    sb.append(", ");
                }
                if (parameter == null) {
                    sb.append("null");
                } else if (parameter instanceof Number) {
                    sb.append(parameter);
                } else if (parameter instanceof CharSequence) {
                    sb.append("'").append(parameter).append("'");
                } else if (parameter instanceof JQRenderable) {
                    sb.append(((JQRenderableparameter).render());
                }
            }
        }
        sb.append(")");
        return sb.toString();
    }
New to GrepCode? Check out our FAQ X