org.bitbucket.brunneng.qb.QueryWithParams Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of query-builder Show documentation
Show all versions of query-builder Show documentation
Compact tool for building SQL, JPA or hibernate queries.
Supports utilities for spring pagination and sorting.
Supports extending to other types of query languages.
Has no transitive dependencies - use only what you need.
The newest version!
package org.bitbucket.brunneng.qb;
import java.util.Collections;
import java.util.Map;
import java.util.StringJoiner;
/**
* Immutable POJO which holds query string and it's named parameters map.
*/
public class QueryWithParams {
private final String query;
private final Map parameters;
public QueryWithParams(String query, Map parameters) {
this.query = query;
this.parameters = Collections.unmodifiableMap(parameters);
}
public String getQuery() {
return query;
}
public Map getParameters() {
return parameters;
}
@Override
public String toString() {
return new StringJoiner(", ", "[", "]")
.add("query='" + query + "'")
.add("parameters=" + parameters)
.toString();
}
}