
nl.vpro.domain.constraint.Constraints Maven / Gradle / Ivy
package nl.vpro.domain.constraint;
/**
* @author Michiel Meeuwissen
* @since 4.8
*/
public class Constraints {
private Constraints() {
}
@SuppressWarnings("unchecked")
public static Constraint alwaysTrue() {
return (Constraint) AlwaysTrue.INSTANCE;
}
@SuppressWarnings("unchecked")
public static Constraint alwaysFalse() {
return (Constraint) AlwaysFalse.INSTANCE;
}
public static class AlwaysTrue implements Constraint {
private static final AlwaysTrue> INSTANCE = new AlwaysTrue<>();
@Override
public boolean test(T mediaObject) {
return true;
}
@Override
public String toString() {
return "ALWAYS TRUE";
}
}
public static class AlwaysFalse implements Constraint {
private static final AlwaysFalse> INSTANCE = new AlwaysFalse<>();
@Override
public boolean test(T mediaObject) {
return false;
}
@Override
public String toString() {
return "ALWAYS FALSE";
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy