📄 transport.java
字号:
package com.bv.api;import java.util.Vector;import com.bv.api.response.ApiResponse;/** * This class is designed to store the Server URL and UAID for the user, * to prevent the programmer having to pass the details around. * * This is a singleton class - there is only ever 1 instance of this class. * @author C. Oattes * */public class Transport { private String uaid; private String serverURL; private static Transport transport; private Transport() { } /** * This method returns the transport object * @return The Transport object */ public static synchronized Transport getTransport() { if(transport == null) { return new Transport(); } else { return transport; } } /** * This method returns the transport object, and sets the server URL and uaid * @return The Transport object */ public static synchronized Transport getTransport(String serverURL, String uaid) { Transport t = getTransport(); t.setServerURL(serverURL); t.setUaid(uaid); return t; } /** * Get the uaid that has been set * @return uaid */ public String getUaid() { return uaid; } /** * Set the uaid * @param uaid */ public void setUaid(String uaid) { this.uaid = uaid; } /** * Get the server url that has been set * @return serverURL */ public String getServerURL() { return serverURL; } /** * Set the server URL * @param serverURL */ public void setServerURL(String serverURL) { this.serverURL = serverURL; } /** * Starts the API call, passing the UAID and Server URL * @param method An API method object (such as SendSMS) * @return The server response object * @throws InvalidParameterException * @throws ParamNotPresentException */ public ApiResponse execute(APICall method) throws InvalidParameterException, ParamNotPresentException { Vector<String> pnp = new Vector<String>(); if(uaid == null) { pnp.add("uaid"); } if(serverURL == null) { pnp.add("serverURL"); } if(pnp.size() > 0) { throw new ParamNotPresentException(pnp); } return method.execute(uaid, serverURL); }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -