public enum XzglJcdEnum
{
/**
* 监测点fid、url、type
*/
JCD1("10000010000043", "xzgljk/ycjc/yjxx_jgList_1", "JG"),
JCD2("10000010000040", "xzgljk/ycjc/yjxx_jgList_2", "ZA"),
JCD3("10000010000047", "xzgljk/ycjc/yjxx_jgList_1", "JG");
private String fid;
private String url;
private String type;
//构造方法
private XzglJcdEnum(String fid, String url, String type)
{
this.fid = fid;
this.url = url;
this.type = type;
}
/**
* 根据fid获取value(value.getUrl()和value.getType())
* @param fid
* @return
*/
public static XzglJcdEnum getByFid(String fid)
{
XzglJcdEnum[] values = XzglJcdEnum.values();
for (XzglJcdEnum value : values)
{
if (value.getFid().equals(fid))
{
return value;
}
}
return null;
}
/**
* fid属性的get方法
* @return the fid
*/
public String getFid() {
return fid;
}
/**
* fid属性的set方法
* @param fid the fid to set
*/
public void setFid(String fid) {
this.fid = fid;
}
/**
* url属性的get方法
* @return the url
*/
public String getUrl() {
return url;
}
/**
* url属性的set方法
* @param url the url to set
*/
public void setUrl(String url) {
this.url = url;
}
/**
* type属性的get方法
* @return the type
*/
public String getType() {
return type;
}
/**
* type属性的set方法
* @param type the type to set
*/
public void setType(String type) {
this.type = type;
}
public static void main(String[] args) {
String url = getByFid("10000010000043").getUrl();
String type = getByFid("10000010000043").getType();
System.out.println("url:"+ url + ",type:" + type);
}
}
更多使用方法,查看这里