Coverage Report - com.ctrip.apollo.model.ConfigChange
 
Classes in this File Line Coverage Branch Coverage Complexity
ConfigChange
65%
17/26
N/A
1
 
 1  
 package com.ctrip.apollo.model;
 2  
 
 3  
 
 4  
 import com.google.common.base.MoreObjects;
 5  
 
 6  
 import com.ctrip.apollo.enums.PropertyChangeType;
 7  
 
 8  
 /**
 9  
  * Holds the information for a config change.
 10  
  * @author Jason Song(song_s@ctrip.com)
 11  
  */
 12  
 public class ConfigChange {
 13  
   private final String namespace;
 14  
   private final String propertyName;
 15  
   private String oldValue;
 16  
   private String newValue;
 17  
   private PropertyChangeType changeType;
 18  
 
 19  
   /**
 20  
    * Constructor.
 21  
    * @param namespace the namespace of the key
 22  
    * @param propertyName the key whose value is changed
 23  
    * @param oldValue the value before change
 24  
    * @param newValue the value after change
 25  
    * @param changeType the change type
 26  
    */
 27  
   public ConfigChange(String namespace, String propertyName, String oldValue, String newValue,
 28  11
                       PropertyChangeType changeType) {
 29  11
     this.namespace = namespace;
 30  11
     this.propertyName = propertyName;
 31  11
     this.oldValue = oldValue;
 32  11
     this.newValue = newValue;
 33  11
     this.changeType = changeType;
 34  11
   }
 35  
 
 36  
   public String getPropertyName() {
 37  26
     return propertyName;
 38  
   }
 39  
 
 40  
   public String getOldValue() {
 41  25
     return oldValue;
 42  
   }
 43  
 
 44  
   public String getNewValue() {
 45  26
     return newValue;
 46  
   }
 47  
 
 48  
   public PropertyChangeType getChangeType() {
 49  15
     return changeType;
 50  
   }
 51  
 
 52  
   public void setOldValue(String oldValue) {
 53  8
     this.oldValue = oldValue;
 54  8
   }
 55  
 
 56  
   public void setNewValue(String newValue) {
 57  8
     this.newValue = newValue;
 58  8
   }
 59  
 
 60  
   public void setChangeType(PropertyChangeType changeType) {
 61  1
     this.changeType = changeType;
 62  1
   }
 63  
 
 64  
   public String getNamespace() {
 65  0
     return namespace;
 66  
   }
 67  
 
 68  
   @Override
 69  
   public String toString() {
 70  0
     return MoreObjects.toStringHelper(this)
 71  0
         .omitNullValues()
 72  0
         .add("namespace", namespace)
 73  0
         .add("propertyName", propertyName)
 74  0
         .add("oldValue", oldValue)
 75  0
         .add("newValue", newValue)
 76  0
         .add("changeType", changeType)
 77  0
         .toString();
 78  
   }
 79  
 }