/** * {@inheritDoc} */ @Override protected String getErrorMessage(SingleProperty<? extends T> property) { return "Value of property '" + property.getName() + "' must be a percentage value"; } }
/** * {@inheritDoc} */ @Override protected String getErrorMessage(SingleProperty<? extends String> property) { return "Value of property '" + property.getName() + "' is not a valid e-mail address"; } }
/** * {@inheritDoc} */ @Override protected String getErrorMessage(SingleProperty<? extends T> property) { return "Value of property '" + property.getName() + "' must not be empty String/Collection/Map"; } }
/** * {@inheritDoc} */ @Override protected String getErrorMessage(SingleProperty<? extends String> property) { return "At least one entry in property '" + property.getName() + "' is not a valid e-mail address"; }
/** * {@inheritDoc} */ @Override protected String getErrorMessage(SingleProperty<? extends String> property) { return "Value of property '" + property.getName() + "' must be a fully qualified class name"; } }
/** * {@inheritDoc} */ @Override protected String getErrorMessage(SingleProperty<? extends T> property) { return "Value of property '" + property.getName() + "' must be negative"; } }
/** * {@inheritDoc} */ @Override protected String getErrorMessage(SingleProperty<? extends T> property) { return "Value of property '" + property.getName() + "' must be positive"; } }
/** * {@inheritDoc} */ @Override protected void compare(SingleProperty<? extends T> property, SingleProperty<? extends T> againstProperty, T value, T against, PropertyValidation propertyValidation) { if (!matches(value, against)) { List<SingleProperty<?>> properties = new ArrayList<>(2); properties.add(property); properties.add(againstProperty); ValidationError validationError = new ValidationError(properties, "Value of property '" + property.getName() + "' must be less than value of property '" + againstProperty.getName() + "'"); propertyValidation.addValidationError(validationError); } }
/** * {@inheritDoc} */ @Override protected void compare(SingleProperty<? extends T> property, SingleProperty<? extends T> againstProperty, T value, T against, PropertyValidation propertyValidation) { if (!matches(value, against)) { List<SingleProperty<?>> properties = new ArrayList<>(2); properties.add(property); properties.add(againstProperty); ValidationError validationError = new ValidationError(properties, "Value of property '" + property.getName() + "' must be less or equal than value of property '" + againstProperty.getName() + "'"); propertyValidation.addValidationError(validationError); } }
/** * {@inheritDoc} */ @Override protected void compare(SingleProperty<? extends T> property, SingleProperty<? extends T> againstProperty, T value, T against, PropertyValidation propertyValidation) { if (!matches(value, against)) { List<SingleProperty<?>> properties = new ArrayList<>(2); properties.add(property); properties.add(againstProperty); ValidationError validationError = new ValidationError(properties, "Value of property '" + property.getName() + "' must be greater or equal than value of property '" + againstProperty.getName() + "'"); propertyValidation.addValidationError(validationError); } }
/** * {@inheritDoc} */ @Override protected void compare(SingleProperty<? extends T> property, SingleProperty<? extends T> againstProperty, T value, T against, PropertyValidation propertyValidation) { if (!matches(value, against)) { List<SingleProperty<?>> properties = new ArrayList<>(2); properties.add(property); properties.add(againstProperty); ValidationError validationError = new ValidationError(properties, "Value of property '" + property.getName() + "' must be greater than value of property '" + againstProperty.getName() + "'"); propertyValidation.addValidationError(validationError); } }
/** * {@inheritDoc} */ @Override protected void compare(SingleProperty<? extends T> property, T value, T against, PropertyValidation propertyValidation) { if (!matches(value, against)) { ValidationError validationError = new ValidationError(Collections.<SingleProperty<?>> singletonList(property), "Value of property '" + property.getName() + "' must be greater or equal than " + against); propertyValidation.addValidationError(validationError); } }
/** * {@inheritDoc} */ @Override protected void compare(SingleProperty<? extends T> property, T value, T against, PropertyValidation propertyValidation) { if (!matches(value, against)) { ValidationError validationError = new ValidationError(Collections.<SingleProperty<?>> singletonList(property), "Value of property '" + property.getName() + "' must be greater than " + against); propertyValidation.addValidationError(validationError); } }
/** * {@inheritDoc} */ @Override protected void compare(SingleProperty<? extends T> property, T value, T against, PropertyValidation propertyValidation) { if (!matches(value, against)) { ValidationError validationError = new ValidationError(Collections.<SingleProperty<?>> singletonList(property), "Value of property '" + property.getName() + "' must be less than " + against); propertyValidation.addValidationError(validationError); } }
/** * {@inheritDoc} */ @Override protected void compare(SingleProperty<? extends T> property, T value, T against, PropertyValidation propertyValidation) { if (!matches(value, against)) { ValidationError validationError = new ValidationError(Collections.<SingleProperty<?>> singletonList(property), "Value of property '" + property.getName() + "' must be less or equal than " + against); propertyValidation.addValidationError(validationError); } }
/** * Retrieves against value from {@link #than} for given property. If parsing fails the * {@link PropertyValidation} will be filled with error and <code>null</code> will be returned * as value. * * @param property * Property to get against value for. * @param propertyValidation * Validation to report errors. * @return Value or <code>null</code> if parsing fails. */ private T getAgainstValue(SingleProperty<? extends T> property, PropertyValidation propertyValidation) { T against = property.parseLiteral(than); if (null == against) { ValidationError validationError = new ValidationError(Collections.<SingleProperty<?>> singletonList(property), "Validation of property " + property.getName() + " failed because literal (" + than + ") to compare against can not be parsed."); propertyValidation.addValidationError(validationError); } return against; }
name.setText(property.getName() + ":"); name.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false));
LOG.info("Property '" + property.getName() + "' successfully updated, new value is " + value);