Interface IConstraint<T>


public interface IConstraint<T>
Version:
$Revision$
Author:
Tom
  • Field Details

    • UNDEFINED

      static final int UNDEFINED
      usable for int definitions that are not bitfields
      See Also:
    • UNSET

      static final int UNSET
      usable for all int definitions like bitfiels type and style
      See Also:
  • Method Details

    • getFormat

      Format getFormat()
      format-constraint for the attributes value
    • getType

      Class<T> getType()
      value type
    • checkStatus

      IStatus checkStatus(String name, T value)
      checks, if the given value is valid - should not throw an exception
    • check

      void check(String name, T value)
      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

      <C extends IConstraint<T>> C setNumberDef(int scale, int precision)
      define number definitions - if the attribute is a number
    • setRange

      <C extends IConstraint<T>> C setRange(Comparable<T> min, Comparable<T> max)
      defines a min/max range constraint. use ValueCompare to compare on changing values
    • setRange

      <C extends IConstraint<T>> C setRange(Collection<T> allowedValues)
      defines all allowed values - if you call setRange(Comparable, Comparable), you shouldn't call this method
    • setFormat

      <C extends IConstraint<T>> C setFormat(Format format)
      define constraining text format. use RegularExpressionFormat to define a regexp pattern
    • setType

      <C extends IConstraint<T>> C setType(Class<T> type)
      define type
    • setLength

      <C extends IConstraint<T>> C setLength(int length)
      define maximum length
    • setScale

      <C extends IConstraint<T>> C setScale(int scale)
      define scale
    • setPrecision

      <C extends IConstraint<T>> C setPrecision(int precision)
      define precision
    • setNullable

      <C extends IConstraint<T>> C setNullable(boolean nullable)
      define nullable
    • setDefault

      <C extends IConstraint<T>> C setDefault(T defaultValue)
    • fromString

      static Object fromString(Class<?> type, String def)