liquibase.Contexts Maven / Gradle / Ivy
package liquibase;
import liquibase.util.StringUtils;
import java.util.*;
public class Contexts extends HashSet {
public Contexts() {
}
public Contexts(String... contexts) {
if (contexts.length == 1) {
parseContextString(contexts[0]);
} else {
addAll(Arrays.asList(contexts));
}
}
public Contexts(String contexts) {
parseContextString(contexts);
}
private void parseContextString(String contexts) {
contexts = StringUtils.trimToNull(contexts);
if (contexts == null) {
return;
}
addAll(StringUtils.splitAndTrim(contexts, ","));
}
public Contexts(Collection contexts) {
addAll(contexts);
}
@Override
public boolean add(String s) {
return super.add(s.toLowerCase());
}
@Override
public String toString() {
return StringUtils.join(new TreeSet(this),",");
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy