package com.goafanti.news.enums;

import java.util.HashMap;
import java.util.Map;

public enum NewsType {
	ALL(0, "所有"), KJZX(1, "科技资讯"), ZFWL(2, "政府往来"), JTDT(3, "技淘动态"), GJZC(4, "国家政策"), DFZC(5, "地方政策");
	private Integer							code;
	private String							desc;

	private static Map<Integer, NewsType>	status	= new HashMap<Integer, NewsType>();

	private NewsType(Integer code, String desc) {
		this.code = code;
		this.desc = desc;
	}

	static {
		for (NewsType value : NewsType.values()) {
			status.put(value.getCode(), value);
		}
	}

	public static NewsType getField(Integer code) {
		if (containsType(code)) {
			return status.get(code);
		}
		return ALL;
	}

	public static boolean containsType(Integer code) {
		return status.containsKey(code);
	}

	public Integer getCode() {
		return code;
	}

	public String getDesc() {
		return desc;
	}

}
