com.mageddo.togglefirst.DefaultFeatureMetadata Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of toggle-first-core Show documentation
Show all versions of toggle-first-core Show documentation
Enable and disable your features in production on a button click
package com.mageddo.togglefirst;
import java.util.Collections;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.Map;
public class DefaultFeatureMetadata implements FeatureMetadata {
private final Feature feature;
private final Map parameters;
public DefaultFeatureMetadata(Feature feature) {
this(feature, new LinkedHashMap<>());
}
public DefaultFeatureMetadata(Feature feature, Map parameters) {
this.feature = feature;
this.parameters = new HashMap<>(parameters);
}
@Override
public Feature feature() {
return feature;
}
@Override
public Map parameters() {
return Collections.unmodifiableMap(parameters);
}
@Override
public FeatureMetadata set(String k, String v){
parameters.put(k, v);
return this;
}
@Override
public String get(String k){
return parameters.get(k);
}
@Override
public void remove(String k){
parameters.remove(k);
}
}