
io.github.cgi.zabbix.api.RequestBuilder Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of zabbix-api Show documentation
Show all versions of zabbix-api Show documentation
This is simple Zabbix API Client for Java.
It's fork of original client https://github.com/hengyunabc/zabbix-api
but with small changes in java version, dependencies, api contract, tests.
The newest version!
package io.github.cgi.zabbix.api;
import java.util.concurrent.atomic.AtomicInteger;
public class RequestBuilder {
private static final AtomicInteger nextId = new AtomicInteger(1);
private Request request = new Request();
private RequestBuilder(){
}
static public RequestBuilder newBuilder(){
return new RequestBuilder();
}
public Request build(){
if(request.getId() == null){
request.setId(nextId.getAndIncrement());
}
return request;
}
public RequestBuilder version(String version){
request.setJsonrpc(version);
return this;
}
public RequestBuilder paramEntry(String key, Object value){
request.putParam(key, value);
return this;
}
/**
* Do not necessary to call this method.If don not set id, ZabbixApi will auto set request auth..
* @param auth
* @return
*/
public RequestBuilder auth(String auth){
request.setAuth(auth);
return this;
}
public RequestBuilder method(String method){
request.setMethod(method);
return this;
}
/**
* Do not necessary to call this method.If don not set id, RequestBuilder will auto generate.
* @param id
* @return
*/
public RequestBuilder id(Integer id){
request.setId(id);
return this;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy