/** * Create a new SlotSide property for matching the specified value with the * specified operator. * * @param value the value to match * @param operator the operator to use when comparing with other properties */ public SlotSide(Object value, Operator operator) { super(Coerce.<Direction>toEnum(value, Direction.class, Direction.NONE), operator); }
/** * Coerce the specified object to an enum of the supplied type, returns the * first enum constant in the enum if parsing fails. * * @param obj Object to coerce * @param enumClass Enum class to coerce to * @param <E> enum type * @return Coerced enum value */ public static <E extends Enum<E>> E toEnum(@Nullable Object obj, Class<E> enumClass) { return Coerce.toEnum(obj, enumClass, enumClass.getEnumConstants()[0]); }
@Override public int compareTo(Property<?, ?> other) { if (other == null) { return 1; } return this.getValue().compareTo(Coerce.toEnum(other.getValue(), Direction.class, Direction.NONE)); }
@Override public int compareTo(Property<?, ?> o) { return this.getValue().compareTo(o == null ? Matter.SOLID : Coerce.toEnum(o.getValue(), Matter.class)); }
/** * Create a new SlotSide property for matching the specified value with the * specified operator. * * @param value the value to match * @param operator the operator to use when comparing with other properties */ public SlotSide(Object value, Operator operator) { super(Coerce.<Direction>toEnum(value, Direction.class, Direction.NONE), operator); }
/** * Coerce the specified object to an enum of the supplied type, returns the * first enum constant in the enum if parsing fails. * * @param obj Object to coerce * @param enumClass Enum class to coerce to * @param <E> enum type * @return Coerced enum value */ public static <E extends Enum<E>> E toEnum(@Nullable Object obj, Class<E> enumClass) { return Coerce.toEnum(obj, enumClass, enumClass.getEnumConstants()[0]); }
@Override public int compareTo(Property<?, ?> other) { if (other == null) { return 1; } return this.getValue().compareTo(Coerce.toEnum(other.getValue(), Direction.class, Direction.NONE)); }
@Override public int compareTo(Property<?, ?> o) { return this.getValue().compareTo(o == null ? Matter.SOLID : Coerce.toEnum(o.getValue(), Matter.class)); }