All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.ctrip.framework.apollo.model.ConfigChangeEvent Maven / Gradle / Ivy

The newest version!
package com.ctrip.framework.apollo.model;

import java.util.Map;
import java.util.Set;

/**
 * A change event when a namespace's config is changed.
 * @author Jason Song([email protected])
 */
public class ConfigChangeEvent {
  private final String m_namespace;
  private final Map m_changes;

  /**
   * Constructor.
   * @param namespace the namespace of this change
   * @param changes the actual changes
   */
  public ConfigChangeEvent(String namespace,
                           Map changes) {
    m_namespace = namespace;
    m_changes = changes;
  }

  /**
   * Get the keys changed.
   * @return the list of the keys
   */
  public Set changedKeys() {
    return m_changes.keySet();
  }

  /**
   * Get a specific change instance for the key specified.
   * @param key the changed key
   * @return the change instance
   */
  public ConfigChange getChange(String key) {
    return m_changes.get(key);
  }

  /**
   * Check whether the specified key is changed
   * @param key the key
   * @return true if the key is changed, false otherwise.
   */
  public boolean isChanged(String key) {
    return m_changes.containsKey(key);
  }

  /**
   * Get the namespace of this change event.
   * @return the namespace
   */
  public String getNamespace() {
    return m_namespace;
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy