it.amattioli.workstate.actions.NullGuard Maven / Gradle / Ivy
package it.amattioli.workstate.actions;
/**
*
* A guard whose {@link #check(AttributeReader, AttributeReader)} method
* always returns true
*
*
*
* Istances of NullGuard are used as null-objects. It is implemented as a singleton
* so to get an instance use the {@link #getInstance()} factory method.
*
*/
public class NullGuard extends AbstractGuard {
public static final Integer NULL_GUARD_PRIORITY = Integer.valueOf(-1000);
private static final NullGuard instance = new NullGuard();
public static NullGuard getInstance() {
return instance;
}
private NullGuard() {
}
public boolean check(AttributeReader event, AttributeReader state) {
return true;
}
public Integer getPriority() {
return NULL_GUARD_PRIORITY;
}
}