001package systems.dmx.config;
002
003import systems.dmx.core.Topic;
004
005
006
007public enum ConfigTarget {
008
009    SINGLETON("topicUri") {
010        @Override
011        String hashKey(Topic topic) {
012            return hashKey(topic.getUri());
013        }
014    },
015
016    TYPE_INSTANCES("typeUri") {
017        @Override
018        String hashKey(Topic topic) {
019            return hashKey(topic.getTypeUri());
020        }
021    };
022
023    // ---------------------------------------------------------------------------------------------- Instance Variables
024
025    private String prefix;
026
027    // ---------------------------------------------------------------------------------------------------- Constructors
028
029    private ConfigTarget(String prefix) {
030        this.prefix = prefix;
031    }
032
033    // ----------------------------------------------------------------------------------------- Package Private Methods
034
035    String hashKey(String configurableUri) {
036        return prefix + ":" + configurableUri;
037    }
038
039    abstract String hashKey(Topic topic);
040}