exedio cope

com.exedio.cope
Class IntegerField

java.lang.Object
  extended by com.exedio.cope.Feature
      extended by com.exedio.cope.Field<E>
          extended by com.exedio.cope.FunctionField<E>
              extended by com.exedio.cope.NumberField<Integer>
                  extended by com.exedio.cope.IntegerField
All Implemented Interfaces:
Function<Integer>, NumberFunction<Integer>, Selectable<Integer>, Settable<Integer>

public final class IntegerField
extends NumberField<Integer>

Represents a field within a type, that enables instances of that type to store a integer.

Author:
Ralf Wiebicke

Constructor Summary
IntegerField()
          Creates a new mandatory IntegerField.
 
Method Summary
 int checkDefaultToNext()
           
 IntegerField copy()
           
 IntegerField defaultTo(Integer defaultConstant)
           
 IntegerField defaultToNext(int start)
           
 Condition equal(Integer value)
          Returns a condition, that is true for all items, if and only if the value of this function for that item is equal to the given parameter.
 Integer getDefaultNextStart()
           
 SequenceInfo getDefaultToNextInfo()
           
 Set<Class<? extends Throwable>> getInitialExceptions()
          Returns the exceptions possibly thrown, when setting a value for this settable.
 Class getInitialType()
           
 int getMandatory(Item item)
           
 int getMaximum()
           
 int getMinimum()
           
 boolean isDefaultNext()
           
 boolean isInitial()
          Returns true, if a value for the field should be specified on the creation of an item.
 IntegerField max(int maximum)
           
 IntegerField min(int minimum)
           
 IntegerField nonUnique()
           
 Condition notEqual(Integer value)
           
 IntegerField optional()
          Returns a new Field, that differs from this Field by being optional.
 IntegerField range(int minimum, int maximum)
           
 void set(Item item, int value)
           
 IntegerField toFinal()
          Returns a new Field, that differs from this Field by being final.
 IntegerField unique()
          Returns a new FunctionField, that differs from this FunctionField by being unique.
 
Methods inherited from class com.exedio.cope.NumberField
bind, divide, multiply, multiply, plus, plus, sum, sum
 
Methods inherited from class com.exedio.cope.FunctionField
append, appendParameter, appendSelect, between, check, copyFunctionField, equal, equal, get, getDefaultConstant, getImplicitUniqueConstraint, getUniqueConstraints, getWrappers, greater, greater, greaterOrEqual, greaterOrEqual, in, in, isNotNull, isNull, less, less, lessOrEqual, lessOrEqual, max, min, notEqual, searchUnique, searchUnique, set
 
Methods inherited from class com.exedio.cope.Field
castCollection, check, execute, getColumnName, getPattern, getPatterns, getValueClass, isFinal, isMandatory, map, mapNull
 
Methods inherited from class com.exedio.cope.Feature
getAnnotation, getID, getName, getType, toString, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.exedio.cope.Function
appendParameter, between, equal, equal, get, getValueClass, greater, greater, greaterOrEqual, greaterOrEqual, in, in, isNotNull, isNull, less, less, lessOrEqual, lessOrEqual, max, min, notEqual
 
Methods inherited from interface com.exedio.cope.Selectable
append, appendSelect, check, getType, toString
 

Constructor Detail

IntegerField

public IntegerField()
Creates a new mandatory IntegerField.

Method Detail

copy

public IntegerField copy()
Specified by:
copy in class FunctionField<Integer>

toFinal

public IntegerField toFinal()
Description copied from class: Field
Returns a new Field, that differs from this Field by being final. If this Field is already final, the the result is equal to this Field.

Specified by:
toFinal in class Field<Integer>
See Also:
Field.isFinal()

optional

public IntegerField optional()
Description copied from class: Field
Returns a new Field, that differs from this Field by being optional. If this Field is already optional, the the result is equal to this Field.

Specified by:
optional in class Field<Integer>
See Also:
Field.isMandatory()

unique

public IntegerField unique()
Description copied from class: FunctionField
Returns a new FunctionField, that differs from this FunctionField by being unique. If this FunctionField is already unique, the the result is equal to this FunctionField.

Specified by:
unique in class FunctionField<Integer>
See Also:
FunctionField.getImplicitUniqueConstraint()

nonUnique

public IntegerField nonUnique()
Specified by:
nonUnique in class FunctionField<Integer>

defaultTo

public IntegerField defaultTo(Integer defaultConstant)

defaultToNext

public IntegerField defaultToNext(int start)

range

public IntegerField range(int minimum,
                          int maximum)

min

public IntegerField min(int minimum)

max

public IntegerField max(int maximum)

isDefaultNext

public boolean isDefaultNext()

getDefaultNextStart

public Integer getDefaultNextStart()

getMinimum

public int getMinimum()

getMaximum

public int getMaximum()

isInitial

public boolean isInitial()
Returns true, if a value for the field should be specified on the creation of an item. This implementation returns (isFinal() || isMandatory()) && !isDefaultNext().

Specified by:
isInitial in interface Settable<Integer>
Overrides:
isInitial in class FunctionField<Integer>

getInitialExceptions

public Set<Class<? extends Throwable>> getInitialExceptions()
Description copied from interface: Settable
Returns the exceptions possibly thrown, when setting a value for this settable.

Specified by:
getInitialExceptions in interface Settable<Integer>
Overrides:
getInitialExceptions in class FunctionField<Integer>

getInitialType

public Class getInitialType()
Specified by:
getInitialType in interface Settable<Integer>
Overrides:
getInitialType in class FunctionField<Integer>

getMandatory

public int getMandatory(Item item)
Throws:
IllegalArgumentException - if this field is not mandatory.

set

public void set(Item item,
                int value)
         throws UniqueViolationException,
                FinalViolationException,
                IntegerRangeViolationException
Throws:
UniqueViolationException
FinalViolationException
IntegerRangeViolationException

getDefaultToNextInfo

public SequenceInfo getDefaultToNextInfo()

checkDefaultToNext

public int checkDefaultToNext()

equal

public Condition equal(Integer value)
Description copied from interface: Function
Returns a condition, that is true for all items, if and only if the value of this function for that item is equal to the given parameter.

Specified by:
equal in interface Function<Integer>
Overrides:
equal in class FunctionField<Integer>

notEqual

public Condition notEqual(Integer value)
Specified by:
notEqual in interface Function<Integer>
Overrides:
notEqual in class FunctionField<Integer>

Cope with
Object
Persistence

SourceForge.net LogoCopyright © 2004-2008 exedio Gesellschaft für Softwareentwicklung mbH. All rights reserved.
svn.12752 build.5319 20090312135114