##### Coverage Report - com.ctrip.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.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
9 |  |
        * {@code defaultValue} if the key doesn't exist.
10 |  |
        * @param key the property name
11 |  |
        * @param defaultValue the default value is 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
18 |  |
        * {@code defaultValue} if the key doesn't exist.
19 |  |
        * @param key the property name
20 |  |
        * @param defaultValue the default value is key is not found
21 |  |
        * @return the property value as integer
22 |  |
        *
23 |  |
        * @throws NumberFormatException if the property value is invalid
24 |  |
        */
25 |  |
       public Integer getIntProperty(String key, Integer defaultValue);
26 |  |
27 |  |
       /**
28 |  |
        * Return the long property value with the given key, or
29 |  |
        * {@code defaultValue} if the key doesn't exist.
30 |  |
        * @param key the property name
31 |  |
        * @param defaultValue the default value is key is not found
32 |  |
        * @return the property value as long
33 |  |
        *
34 |  |
        * @throws NumberFormatException if the property value is invalid
35 |  |
        */
36 |  |
       public Long getLongProperty(String key, Long defaultValue);
37 |  |
38 |  |
       /**
39 |  |
        * Return the short property value with the given key, or
40 |  |
        * {@code defaultValue} if the key doesn't exist.
41 |  |
        * @param key the property name
42 |  |
        * @param defaultValue the default value is key is not found
43 |  |
        * @return the property value as short
44 |  |
        *
45 |  |
        * @throws NumberFormatException if the property value is invalid
46 |  |
        */
47 |  |
       public Short getShortProperty(String key, Short defaultValue);
48 |  |
49 |  |
       /**
50 |  |
        * Return the float property value with the given key, or
51 |  |
        * {@code defaultValue} if the key doesn't exist.
52 |  |
        * @param key the property name
53 |  |
        * @param defaultValue the default value is key is not found
54 |  |
        * @return the property value as float
55 |  |
        *
56 |  |
        * @throws NumberFormatException if the property value is invalid
57 |  |
        */
58 |  |
       public Float getFloatProperty(String key, Float defaultValue);
59 |  |
60 |  |
       /**
61 |  |
        * Return the double property value with the given key, or
62 |  |
        * {@code defaultValue} if the key doesn't exist.
63 |  |
        * @param key the property name
64 |  |
        * @param defaultValue the default value is key is not found
65 |  |
        * @return the property value as double
66 |  |
        *
67 |  |
        * @throws NumberFormatException if the property value is invalid
68 |  |
        */
69 |  |
       public Double getDoubleProperty(String key, Double defaultValue);
70 |  |
71 |  |
       /**
72 |  |
        * Return the byte property value with the given key, or
73 |  |
        * {@code defaultValue} if the key doesn't exist.
74 |  |
        * @param key the property name
75 |  |
        * @param defaultValue the default value is key is not found
76 |  |
        * @return the property value as byte
77 |  |
        *
78 |  |
        * @throws NumberFormatException if the property value is invalid
79 |  |
        */
80 |  |
       public Byte getByteProperty(String key, Byte defaultValue);
81 |  |
82 |  |
       /**
83 |  |
        * Return the boolean property value with the given key, or
84 |  |
        * {@code defaultValue} if the key doesn't exist.
85 |  |
        * @param key the property name
86 |  |
        * @param defaultValue the default value is key is not found
87 |  |
        * @return the property value as boolean
88 |  |
        */
89 |  |
       public Boolean getBooleanProperty(String key, Boolean defaultValue);
90 |  |
91 |  |
       /**
92 |  |
        * Add change listener to this config instance.
93 |  |
        * @param listener the config change listener
94 |  |
        */
95 |  |
       public void addChangeListener(ConfigChangeListener listener);
96 |  |
     }