
de.codecentric.mule.assertobjectequals.PatternBasedOptionsFactory Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of assert-object-equals-connector Show documentation
Show all versions of assert-object-equals-connector Show documentation
A Mule connector for comparing object structures (Map/List) or XML in MUnit tests.
The newest version!
package de.codecentric.mule.assertobjectequals;
import java.util.ArrayList;
import java.util.Collection;
import java.util.EnumSet;
public class PatternBasedOptionsFactory implements ObjectCompareOptionsFactory {
private EnumSet rootOptions;
private Collection patterns;
public PatternBasedOptionsFactory(EnumSet rootOptions, Collection patterns) {
this.rootOptions = EnumSet.copyOf(rootOptions);
this.patterns = new ArrayList<>(patterns);
}
@Override
public EnumSet createOptions(EnumSet inherited, Path path) {
for (PathPattern pp : patterns) {
if (pp.matches(path)) {
return EnumSet.copyOf(pp.getOptions());
}
}
return EnumSet.copyOf(inherited == null ? rootOptions : inherited);
}
public EnumSet getRootOptions() {
return EnumSet.copyOf(rootOptions);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy