##### Coverage Report - com.ctrip.framework.apollo.Config

Classes in this File | Line Coverage | Branch Coverage | Complexity
Config |
N/A | N/A
N/A | N/A
| 1.0;1

1 |  |
     package com.ctrip.framework.apollo;
2 |  |
3 |  |
     /**
4 |  |
      * @author Jason Song(song_s@ctrip.com)
5 |  |
      */
6 |  |
     public interface Config {
7 |  |
       /**
8 |  |
        * Return the property value with the given key, or {@code defaultValue} if the key doesn't exist.
9 |  |
        *
10 |  |
        * @param key the property name
11 |  |
        * @param defaultValue the default value when key is not found
12 |  |
        * @return the property value
13 |  |
        */
14 |  |
       public String getProperty(String key, String defaultValue);
15 |  |
16 |  |
       /**
17 |  |
        * Return the integer property value with the given key, or {@code defaultValue} if the key
18 |  |
        * doesn't exist.
19 |  |
        *
20 |  |
        * @param key the property name
21 |  |
        * @param defaultValue the default value when key is not found
22 |  |
        * @return the property value as integer
23 |  |
        *
24 |  |
        * @throws NumberFormatException if the property value is invalid
25 |  |
        */
26 |  |
       public Integer getIntProperty(String key, Integer defaultValue);
27 |  |
28 |  |
       /**
29 |  |
        * Return the long property value with the given key, or {@code defaultValue} if the key doesn't
30 |  |
        * exist.
31 |  |
        *
32 |  |
        * @param key the property name
33 |  |
        * @param defaultValue the default value when key is not found
34 |  |
        * @return the property value as long
35 |  |
        *
36 |  |
        * @throws NumberFormatException if the property value is invalid
37 |  |
        */
38 |  |
       public Long getLongProperty(String key, Long defaultValue);
39 |  |
40 |  |
       /**
41 |  |
        * Return the short property value with the given key, or {@code defaultValue} if the key doesn't
42 |  |
        * exist.
43 |  |
        *
44 |  |
        * @param key the property name
45 |  |
        * @param defaultValue the default value when key is not found
46 |  |
        * @return the property value as short
47 |  |
        *
48 |  |
        * @throws NumberFormatException if the property value is invalid
49 |  |
        */
50 |  |
       public Short getShortProperty(String key, Short defaultValue);
51 |  |
52 |  |
       /**
53 |  |
        * Return the float property value with the given key, or {@code defaultValue} if the key doesn't
54 |  |
        * exist.
55 |  |
        *
56 |  |
        * @param key the property name
57 |  |
        * @param defaultValue the default value when key is not found
58 |  |
        * @return the property value as float
59 |  |
        *
60 |  |
        * @throws NumberFormatException if the property value is invalid
61 |  |
        */
62 |  |
       public Float getFloatProperty(String key, Float defaultValue);
63 |  |
64 |  |
       /**
65 |  |
        * Return the double property value with the given key, or {@code defaultValue} if the key doesn't
66 |  |
        * exist.
67 |  |
        *
68 |  |
        * @param key the property name
69 |  |
        * @param defaultValue the default value when key is not found
70 |  |
        * @return the property value as double
71 |  |
        *
72 |  |
        * @throws NumberFormatException if the property value is invalid
73 |  |
        */
74 |  |
       public Double getDoubleProperty(String key, Double defaultValue);
75 |  |
76 |  |
       /**
77 |  |
        * Return the byte property value with the given key, or {@code defaultValue} if the key doesn't
78 |  |
        * exist.
79 |  |
        *
80 |  |
        * @param key the property name
81 |  |
        * @param defaultValue the default value when key is not found
82 |  |
        * @return the property value as byte
83 |  |
        *
84 |  |
        * @throws NumberFormatException if the property value is invalid
85 |  |
        */
86 |  |
       public Byte getByteProperty(String key, Byte defaultValue);
87 |  |
88 |  |
       /**
89 |  |
        * Return the boolean property value with the given key, or {@code defaultValue} if the key
90 |  |
        * doesn't exist.
91 |  |
        *
92 |  |
        * @param key the property name
93 |  |
        * @param defaultValue the default value when key is not found
94 |  |
        * @return the property value as boolean
95 |  |
        */
96 |  |
       public Boolean getBooleanProperty(String key, Boolean defaultValue);
97 |  |
98 |  |
       /**
99 |  |
        * Return the array property value with the given key, or {@code defaultValue} if the key doesn't
100 |  |
        * exist.
101 |  |
        *
102 |  |
        * @param key the property name
103 |  |
        * @param delimiter the delimiter regex
104 |  |
        * @param defaultValue the default value when key is not found
105 |  |
        * @return
106 |  |
        */
107 |  |
       public String[] getArrayProperty(String key, String delimiter, String[] defaultValue);
108 |  |
109 |  |
       /**
110 |  |
        * Add change listener to this config instance.
111 |  |
        *
112 |  |
        * @param listener the config change listener
113 |  |
        */
114 |  |
       public void addChangeListener(ConfigChangeListener listener);
115 |  |
     }