public class ScaleConstraint extends AbstractConstraint
Manages the scale for floating point numbers (i.e., the number of digits to the right of the decimal point).
Supports properties of the following types:
When applied, determines if the number includes more nonzero decimal places than the scale permits. If so, it rounds the number to the maximum number of decimal places allowed by the scale.
The rounding behavior described above occurs automatically when the constraint is applied. This constraint does not generate validation errors.
| Fields inherited from class | Fields |
|---|---|
class AbstractConstraint |
classShortName, constraintOwningClass, constraintParameter, constraintPropertyName, messageSource |
| Constructor and description |
|---|
ScaleConstraint(java.lang.Class<?> constraintOwningClass, java.lang.String constraintPropertyName, java.lang.Object constraintParameter, MessageSource messageSource) |
| Type Params | Return Type | Name and description |
|---|---|---|
|
public java.lang.String |
getName() |
|
public int |
getScale()
|
|
protected void |
processValidate(java.lang.Object target, java.lang.Object propertyValue, Errors errors){@inheritDoc} |
|
public boolean |
supports(java.lang.Class type) |
|
protected java.lang.Object |
validateParameter(java.lang.Object constraintParameter) |
| Methods inherited from class | Name |
|---|---|
class AbstractConstraint |
checkState, getDefaultMessage, getParameter, getPropertyName, isValid, processValidate, rejectValue, rejectValue, rejectValue, rejectValue, rejectValue, rejectValueWithDefaultMessage, skipBlankValues, skipNullValues, toString, validate, validateParameter |
{@inheritDoc}