本文整理汇总了Java中com.ctrip.framework.apollo.model.ConfigChangeEvent.getChange方法的典型用法代码示例。如果您正苦于以下问题:Java ConfigChangeEvent.getChange方法的具体用法?Java ConfigChangeEvent.getChange怎么用?Java ConfigChangeEvent.getChange使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.ctrip.framework.apollo.model.ConfigChangeEvent
的用法示例。
在下文中一共展示了ConfigChangeEvent.getChange方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: SimpleApolloConfigDemo
import com.ctrip.framework.apollo.model.ConfigChangeEvent; //导入方法依赖的package包/类
public SimpleApolloConfigDemo() {
ConfigChangeListener changeListener = new ConfigChangeListener() {
@Override
public void onChange(ConfigChangeEvent changeEvent) {
logger.info("Changes for namespace {}", changeEvent.getNamespace());
for (String key : changeEvent.changedKeys()) {
ConfigChange change = changeEvent.getChange(key);
logger.info("Change - key: {}, oldValue: {}, newValue: {}, changeType: {}",
change.getPropertyName(), change.getOldValue(), change.getNewValue(),
change.getChangeType());
}
}
};
config = ConfigService.getAppConfig();
config.addChangeListener(changeListener);
}
示例2: someChangeHandler
import com.ctrip.framework.apollo.model.ConfigChangeEvent; //导入方法依赖的package包/类
@ApolloConfigChangeListener("application")
private void someChangeHandler(ConfigChangeEvent changeEvent) {
logger.info("[someChangeHandler]Changes for namespace {}", changeEvent.getNamespace());
for (String key : changeEvent.changedKeys()) {
ConfigChange change = changeEvent.getChange(key);
logger.info("[someChangeHandler]Change - key: {}, oldValue: {}, newValue: {}, changeType: {}",
change.getPropertyName(), change.getOldValue(), change.getNewValue(),
change.getChangeType());
}
}
示例3: anotherChangeHandler
import com.ctrip.framework.apollo.model.ConfigChangeEvent; //导入方法依赖的package包/类
@ApolloConfigChangeListener({"application", "FX.apollo"})
private void anotherChangeHandler(ConfigChangeEvent changeEvent) {
logger.info("[anotherChangeHandler]Changes for namespace {}", changeEvent.getNamespace());
for (String key : changeEvent.changedKeys()) {
ConfigChange change = changeEvent.getChange(key);
logger.info("[anotherChangeHandler]Change - key: {}, oldValue: {}, newValue: {}, changeType: {}",
change.getPropertyName(), change.getOldValue(), change.getNewValue(),
change.getChangeType());
}
}
示例4: onChange
import com.ctrip.framework.apollo.model.ConfigChangeEvent; //导入方法依赖的package包/类
@Override
public void onChange(ConfigChangeEvent changeEvent) {
for(String key : changeEvent.changedKeys()){
ConfigChange change = changeEvent.getChange(key);
notifyConfigChange(key, change.getOldValue(), change.getNewValue());
}
}