private static enum DynamicProperty {
cacheManagerName {
@Override
void applyChange(final PropertyChangeEvent evt, final RuntimeCfg config) {
config.cacheManagerName = (String) evt.getNewValue();
}
},
defaultCacheConfiguration {
@Override
void applyChange(final PropertyChangeEvent evt, final RuntimeCfg config) {
LOG.debug("Default Cache Configuration has changed, previously created caches remain untouched");
}
};
abstract void applyChange(PropertyChangeEvent evt, RuntimeCfg config);
}
I think it's nice because it allows you to customize Enum's behavior or perform other actions on use.
Piece of code taken from EhCache Configuration (line 118 and further).
No comments:
Post a Comment