0

Im using Command Object as input to the controller method named search. Im wondering how to bind query parameter named $skip to the skip variable in the Pagination object? Note the $ in the parameter name.

public SearchResult search(Pagination pagination)

which handles following url

http://localhost:8080/api/search?$top=5&$skip=2

QueryInfo looks like this:

public class Pagination {

private Integer skip;
private Integer top;

public Integer getSkip() {
    return skip;
}

public void setSkip(Integer skip) {
    this.skip = skip;
}

public Integer getTop() {
    return top;
}

public void setTop(Integer top) {
    this.top = top;
}

@Override
public String toString() {
    return "Pagination{" +
            "skip=" + skip +
            ", top=" + top +
            '}';
}

}

Also, is it possible to annotate the Command object with validation rules, such as length, required/optional, ++?

Ismar Slomic
  • 5,315
  • 6
  • 44
  • 63

0 Answers0