com.pengrad.telegrambot.request.BaseRequest Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of java-telegram-bot-api Show documentation
Show all versions of java-telegram-bot-api Show documentation
Java API for Telegram Bot API
package com.pengrad.telegrambot.request;
import com.pengrad.telegrambot.response.BaseResponse;
import java.lang.reflect.Type;
import java.util.HashMap;
import java.util.Map;
/**
* stas
* 5/1/16.
*/
abstract public class BaseRequest {
@SuppressWarnings("unchecked")
protected final T thisAsT = (T) this;
private final Class extends R> responseClass;
private final Map parameters;
public BaseRequest(Class extends R> responseClass) {
this.responseClass = responseClass;
this.parameters = new HashMap();
}
protected T add(String name, Object val) {
parameters.put(name, val);
return thisAsT;
}
public String getMethod() {
String className = this.getClass().getSimpleName();
return Character.toLowerCase(className.charAt(0)) + className.substring(1);
}
public Map getParameters() {
return parameters;
}
public Type getResponseType() {
return responseClass;
}
public boolean isMultipart() {
return false;
}
public String getFileName() {
return ContentTypes.GENERAL_FILE_NAME;
}
public String getContentType() {
return ContentTypes.GENERAL_MIME_TYPE;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy