All Downloads are FREE. Search and download functionalities are using the official Maven repository.

nl.vpro.domain.constraint.Constraints Maven / Gradle / Ivy

Go to download

Contains the objects used by the Frontend API, like forms and result objects

There is a newer version: 8.3.3
Show newest version
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