public class HasPriorityComparator<T> implements Comparator<T>, Serializable {
private static final long serialVersionUID = 40000L;
private static double getPriority(@Nonnull Object p) {
HasPriority priority = p.getClass().getAnnotation(HasPriority.class);
if (priority != null) {
return priority.value();
}
// if the object does not have a priority annotation, only use
// it last
return Double.MAX_VALUE;
}