Package de.tsl2.nano.action
Interface IConstraint<T>
public interface IConstraint<T>
- Version:
- $Revision$
- Author:
- Tom
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionvoidchecks, if the given value is valid - throws an exceptioncheckStatus(String name, T value) checks, if the given value is valid - should not throw an exceptionstatic ObjectfromString(Class<?> type, String def) returns the allowed values or nulldefault value for this attributeformat-constraint for the attributes valueintmaximum length - useful on stringsreturns the maximum value or nullreturns the minimum value or nullintprecision - useful for numbers of type BigDecimalintgetScale()scale - useful for numbers of type BigDecimalgetType()value typebooleanshould return true, if attribute-value may be null<C extends IConstraint<T>>
CsetBasicDef(int length, boolean nullable, Format format, T defaultValue) define some basic attribute definitions<C extends IConstraint<T>>
CsetDefault(T defaultValue) <C extends IConstraint<T>>
Cdefine constraining text format. use RegularExpressionFormat to define a regexp pattern<C extends IConstraint<T>>
CsetLength(int length) define maximum length<C extends IConstraint<T>>
CsetNullable(boolean nullable) define nullable<C extends IConstraint<T>>
CsetNumberDef(int scale, int precision) define number definitions - if the attribute is a number<C extends IConstraint<T>>
CsetPrecision(int precision) define precision<C extends IConstraint<T>>
CsetRange(Comparable<T> min, Comparable<T> max) defines a min/max range constraint. useValueCompareto compare on changing values<C extends IConstraint<T>>
CsetRange(Collection<T> allowedValues) defines all allowed values - if you callsetRange(Comparable, Comparable), you shouldn't call this method<C extends IConstraint<T>>
CsetScale(int scale) define scale<C extends IConstraint<T>>
Cdefine type
-
Field Details
-
UNDEFINED
static final int UNDEFINEDusable for int definitions that are not bitfields- See Also:
-
UNSET
static final int UNSETusable for all int definitions like bitfiels type and style- See Also:
-
-
Method Details
-
getFormat
Format getFormat()format-constraint for the attributes value -
getType
value type -
checkStatus
checks, if the given value is valid - should not throw an exception -
check
checks, if the given value is valid - throws an exception -
getDefault
T getDefault()default value for this attribute -
getMinimum
Comparable<T> getMinimum()returns the minimum value or null -
getMaximum
Comparable<T> getMaximum()returns the maximum value or null -
getAllowedValues
Collection<T> getAllowedValues()returns the allowed values or null -
getLength
int getLength()maximum length - useful on strings -
getScale
int getScale()scale - useful for numbers of type BigDecimal -
getPrecision
int getPrecision()precision - useful for numbers of type BigDecimal -
isNullable
boolean isNullable()should return true, if attribute-value may be null -
setBasicDef
<C extends IConstraint<T>> C setBasicDef(int length, boolean nullable, Format format, T defaultValue) define some basic attribute definitions -
setNumberDef
define number definitions - if the attribute is a number -
setRange
defines a min/max range constraint. useValueCompareto compare on changing values -
setRange
defines all allowed values - if you callsetRange(Comparable, Comparable), you shouldn't call this method -
setFormat
define constraining text format. use RegularExpressionFormat to define a regexp pattern -
setType
define type -
setLength
define maximum length -
setScale
define scale -
setPrecision
define precision -
setNullable
define nullable -
setDefault
-
fromString
-