org.zodiac.actuate.feature.HasFeatures Maven / Gradle / Ivy
The newest version!
package org.zodiac.actuate.feature;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
public class HasFeatures {
private final List> abstractFeatures = new ArrayList<>();
private final List namedFeatures = new ArrayList<>();
public HasFeatures(List> abstractFeatures, List namedFeatures) {
this.abstractFeatures.addAll(abstractFeatures);
this.namedFeatures.addAll(namedFeatures);
}
public static HasFeatures abstractFeatures(Class>... abstractFeatures) {
return new HasFeatures(Arrays.asList(abstractFeatures), Collections.emptyList());
}
public static HasFeatures namedFeatures(NamedFeature... namedFeatures) {
return new HasFeatures(Collections.>emptyList(), Arrays.asList(namedFeatures));
}
public static HasFeatures namedFeature(String name, Class> type) {
return namedFeatures(new NamedFeature(name, type));
}
public static HasFeatures namedFeatures(String name1, Class> type1, String name2, Class> type2) {
return namedFeatures(new NamedFeature(name1, type1), new NamedFeature(name2, type2));
}
public List> getAbstractFeatures() {
return this.abstractFeatures;
}
public List getNamedFeatures() {
return this.namedFeatures;
}
}