Coverage Report - com.ctrip.framework.apollo.model.ConfigChange
 
Classes in this File Line Coverage Branch Coverage Complexity
ConfigChange
65%
17/26
N/A
1
 
 1  
 package com.ctrip.framework.apollo.model;
 2  
 
 3  
 
 4  
 import com.google.common.base.Objects;
 5  
 
 6  
 import com.ctrip.framework.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  10
                       PropertyChangeType changeType) {
 29  10
     this.namespace = namespace;
 30  10
     this.propertyName = propertyName;
 31  10
     this.oldValue = oldValue;
 32  10
     this.newValue = newValue;
 33  10
     this.changeType = changeType;
 34  10
   }
 35  
 
 36  
   public String getPropertyName() {
 37  23
     return propertyName;
 38  
   }
 39  
 
 40  
   public String getOldValue() {
 41  23
     return oldValue;
 42  
   }
 43  
 
 44  
   public String getNewValue() {
 45  24
     return newValue;
 46  
   }
 47  
 
 48  
   public PropertyChangeType getChangeType() {
 49  14
     return changeType;
 50  
   }
 51  
 
 52  
   public void setOldValue(String oldValue) {
 53  7
     this.oldValue = oldValue;
 54  7
   }
 55  
 
 56  
   public void setNewValue(String newValue) {
 57  7
     this.newValue = newValue;
 58  7
   }
 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
     final StringBuilder sb = new StringBuilder("ConfigChange{");
 71  0
     sb.append("namespace='").append(namespace).append('\'');
 72  0
     sb.append(", propertyName='").append(propertyName).append('\'');
 73  0
     sb.append(", oldValue='").append(oldValue).append('\'');
 74  0
     sb.append(", newValue='").append(newValue).append('\'');
 75  0
     sb.append(", changeType=").append(changeType);
 76  0
     sb.append('}');
 77  0
     return sb.toString();
 78  
   }
 79  
 }