nl.vpro.domain.constraint.Constraints Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of api-domain Show documentation
Show all versions of api-domain Show documentation
Contains the objects used by the Frontend API, like forms and result objects
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