* Registers the constraint with the registry, if present. Call this method if * you want the constraint to be auto-registered. */ public void initialize() { if (registry != null) { registry.register(shortName, this); } } /** * Check that the given value is not null. * * @param name the name of the property * @param value the value to check for null * * @throws DictionaryException if the the property is null */ protected void checkPropertyNotNull(String name, Object value) { if (value == null) { throw new DictionaryException(AbstractConstraint.ERR_PROP_NOT_SET, name, getShortName()); } } /** * @see #evaluateSingleValue(Object) * @see #evaluateCollection(Collection) */ @SuppressWarnings("unchecked") public final void evaluate(Object value) { if (value == null) { // null values are never evaluated return; } try { // ensure that we can handle collections if (DefaultTypeConverter.INSTANCE.isMultiValued(value)) { Collection collection = DefaultTypeConverter.INSTANCE.getCollection(Object.class, value); evaluateCollection(collection); } else { evaluateSingleValue(value); } } catch (ConstraintException e) { // this can go throw e; } catch (Throwable e) { throw new DictionaryException(AbstractConstraint.ERR_EVALUATE_EXCEPTION, this, e.getMessage()); } } /** * Only override if there is some specific evaluation that needs to be performed on the * collection as a whole. * * @param collection the collection of values to evaluate * * @see #evaluateSingleValue(Object) */ protected void evaluateCollection(Collection