##### Coverage Report - com.ctrip.framework.apollo.core.enums.ConfigFileFormat

Classes in this File | Line Coverage | Branch Coverage | Complexity
ConfigFileFormat |
0% | 0/12
0% | 0/12
| 3.3333333333333335;3.333

1 |  |
     package com.ctrip.framework.apollo.core.enums;
2 |  |
3 |  |
     import com.ctrip.framework.apollo.core.utils.StringUtils;
4 |  |
5 |  |
     /**
6 |  |
      * @author Jason Song(song_s@ctrip.com)
7 |  |
      */
8 | 0 |
     public enum ConfigFileFormat {
9 | 0 |
       Properties("properties"), XML("xml");
10 |  |
11 |  |
       private String value;
12 |  |
13 | 0 |
       ConfigFileFormat(String value) {
14 | 0 |
         this.value = value;
15 | 0 |
       }
16 |  |
17 |  |
       public String getValue() {
18 | 0 |
         return value;
19 |  |
       }
20 |  |
21 |  |
       public static ConfigFileFormat fromString(String value){
22 | 0 |
         if (StringUtils.isEmpty(value)){
23 | 0 |
           throw new IllegalArgumentException("value can not be empty");
24 |  |
         }
25 | 0 |
         switch (value){
26 |  |
           case "properties":
27 | 0 |
             return Properties;
28 |  |
           case "xml":
29 | 0 |
             return XML;
30 |  |
         }
31 | 0 |
         throw new IllegalArgumentException(value + " can not map enum");
32 |  |
       }
33 |  |
     }