package com.chenyang.nse.bussiness.enumeration.file;

public enum CodePage {
   UTF8("0", "UTF-8"),
   GBK("1", "GBK");

   private String flag;
   private String name;

   private CodePage(String flag, String name) {
      this.flag = flag;
      this.name = name;
   }

   public String getFlag() {
      return this.flag;
   }

   public void setFlag(String flag) {
      this.flag = flag;
   }

   public String getName() {
      return this.name;
   }

   public void setName(String name) {
      this.name = name;
   }

   public static String getFlag(String name) {
      for(CodePage f : values()) {
         if (f.getName().equals(name)) {
            return f.getFlag();
         }
      }

      return null;
   }

   public static String getName(String flag) {
      for(CodePage f : values()) {
         if (f.getFlag().equals(flag)) {
            return f.getName();
         }
      }

      return null;
   }
}
