public interface IConstraint<T>
| Modifier and Type | Field and Description |
|---|---|
static int |
UNDEFINED
usable for int definitions that are not bitfields
|
static int |
UNSET
usable for all int definitions like bitfiels type and style
|
| Modifier and Type | Method and Description |
|---|---|
void |
check(String name,
T value)
checks, if the given value is valid - throws an exception
|
IStatus |
checkStatus(String name,
T value)
checks, if the given value is valid - should not throw an exception
|
static Object |
fromString(Class<?> type,
String def) |
Collection<T> |
getAllowedValues()
returns the allowed values or null
|
T |
getDefault()
default value for this attribute
|
Format |
getFormat()
format-constraint for the attributes value
|
int |
getLength()
maximum length - useful on strings
|
Comparable<T> |
getMaximum()
returns the maximum value or null
|
Comparable<T> |
getMinimum()
returns the minimum value or null
|
int |
getPrecision()
precision - useful for numbers of type BigDecimal
|
int |
getScale()
scale - useful for numbers of type BigDecimal
|
Class<T> |
getType()
value type
|
boolean |
isNullable()
should return true, if attribute-value may be null
|
<C extends IConstraint<T>> |
setBasicDef(int length,
boolean nullable,
Format format,
T defaultValue)
define some basic attribute definitions
|
<C extends IConstraint<T>> |
setDefault(T defaultValue) |
<C extends IConstraint<T>> |
setFormat(Format format)
define constraining text format. use RegularExpressionFormat to define a regexp pattern
|
<C extends IConstraint<T>> |
setLength(int length)
define maximum length
|
<C extends IConstraint<T>> |
setNullable(boolean nullable)
define nullable
|
<C extends IConstraint<T>> |
setNumberDef(int scale,
int precision)
define number definitions - if the attribute is a number
|
<C extends IConstraint<T>> |
setPrecision(int precision)
define precision
|
<C extends IConstraint<T>> |
setRange(Collection<T> allowedValues)
defines all allowed values - if you call
setRange(Comparable, Comparable), you shouldn't call this
method |
<C extends IConstraint<T>> |
setRange(Comparable<T> min,
Comparable<T> max)
defines a min/max range constraint. use
ValueCompare to compare on changing values |
<C extends IConstraint<T>> |
setScale(int scale)
define scale
|
<C extends IConstraint<T>> |
setType(Class<T> type)
define type
|
static final int UNDEFINED
static final int UNSET
Format getFormat()
IStatus checkStatus(String name, T value)
T getDefault()
Comparable<T> getMinimum()
Comparable<T> getMaximum()
Collection<T> getAllowedValues()
int getLength()
int getScale()
int getPrecision()
boolean isNullable()
<C extends IConstraint<T>> C setBasicDef(int length, boolean nullable, Format format, T defaultValue)
<C extends IConstraint<T>> C setNumberDef(int scale, int precision)
<C extends IConstraint<T>> C setRange(Comparable<T> min, Comparable<T> max)
ValueCompare to compare on changing values<C extends IConstraint<T>> C setRange(Collection<T> allowedValues)
setRange(Comparable, Comparable), you shouldn't call this
method<C extends IConstraint<T>> C setFormat(Format format)
<C extends IConstraint<T>> C setType(Class<T> type)
<C extends IConstraint<T>> C setLength(int length)
<C extends IConstraint<T>> C setScale(int scale)
<C extends IConstraint<T>> C setPrecision(int precision)
<C extends IConstraint<T>> C setNullable(boolean nullable)
<C extends IConstraint<T>> C setDefault(T defaultValue)
Copyright © 2012–2018. All rights reserved.