com.cybermkd.route.core.multipart.MultipartParam Maven / Gradle / Ivy
package com.cybermkd.route.core.multipart;
import com.cybermkd.common.http.UploadedFile;
import java.util.Hashtable;
import java.util.List;
/**
* Created by wangrenhui on 15/4/2.
*/
public class MultipartParam {
private Hashtable uploadedFiles;
private Hashtable> params; // name - Vector of values
public MultipartParam(Hashtable uploadedFiles, Hashtable> params) {
this.uploadedFiles = uploadedFiles;
this.params = params;
}
public Hashtable getUploadedFiles() {
return uploadedFiles;
}
public UploadedFile getUploadedFileFirst() {
return uploadedFiles != null && uploadedFiles.size() > 0 ? uploadedFiles.values().iterator().next() : null;
}
public UploadedFile getUploadedFile(String filename) {
if (uploadedFiles != null) {
return uploadedFiles.get(filename);
}
return null;
}
public Hashtable> getParams() {
return params;
}
public List getParam(String name) {
if (params != null) {
return params.get(name);
}
return null;
}
public String getParamFirst(String name) {
if (params != null) {
List value = params.get(name);
return value != null && value.size() > 0 ? value.get(0) : null;
}
return null;
}
}