net.datacrow.enhancers
Class AutoIncrementer

java.lang.Object
  extended by net.datacrow.enhancers.AutoIncrementer
All Implemented Interfaces:
IValueEnhancer

public class AutoIncrementer
extends java.lang.Object
implements IValueEnhancer

Auto numbering functionality. Applies a new number to the indicated number field.

Author:
Robert Jan van der Waals
See Also:
IValueEnhancer

Constructor Summary
AutoIncrementer(int field)
          Creates a new instance.
AutoIncrementer(int field, boolean enabled, boolean fillGaps, int step)
          Creates a new instance.
 
Method Summary
 java.lang.Object apply(DcField field, java.lang.Object value)
          Apply the enhancement.
 int getField()
           
 int getIndex()
          Unique ID for this enhancer.
 int getStep()
           
 boolean isEnabled()
          Indicates if this enhancer is enabled.
 boolean isFillGaps()
           
 boolean isRunOnInsert()
          Indicates if the enhancement should be performed after inserting an item.
 boolean isRunOnUpdating()
          Indicates if the enhancement should be performed after updating an item.
 void parse(java.lang.String s)
          Parses a string representation.
 java.lang.String toSaveString()
          Creates a string representation which can be stored to disk.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AutoIncrementer

public AutoIncrementer(int field)
Creates a new instance.

Parameters:
field - The field to which enhancements will be made.

AutoIncrementer

public AutoIncrementer(int field,
                       boolean enabled,
                       boolean fillGaps,
                       int step)
Creates a new instance.

Parameters:
field - The field to which enhancements will be made.
enabled - Indicates if this enhancer is enabled.
fillGaps - Indicates if gaps in the numbering should be filled.
step - The step size (amount to increase per number).
Method Detail

toSaveString

public java.lang.String toSaveString()
Description copied from interface: IValueEnhancer
Creates a string representation which can be stored to disk.

Specified by:
toSaveString in interface IValueEnhancer

isEnabled

public boolean isEnabled()
Description copied from interface: IValueEnhancer
Indicates if this enhancer is enabled.

Specified by:
isEnabled in interface IValueEnhancer

isFillGaps

public boolean isFillGaps()

getStep

public int getStep()

isRunOnUpdating

public boolean isRunOnUpdating()
Description copied from interface: IValueEnhancer
Indicates if the enhancement should be performed after updating an item.

Specified by:
isRunOnUpdating in interface IValueEnhancer

isRunOnInsert

public boolean isRunOnInsert()
Description copied from interface: IValueEnhancer
Indicates if the enhancement should be performed after inserting an item.

Specified by:
isRunOnInsert in interface IValueEnhancer

apply

public java.lang.Object apply(DcField field,
                              java.lang.Object value)
Description copied from interface: IValueEnhancer
Apply the enhancement.

Specified by:
apply in interface IValueEnhancer
Parameters:
field - The field to enhance.
value - The value.
Returns:
The result of the enhancement.

getField

public int getField()

parse

public void parse(java.lang.String s)
Description copied from interface: IValueEnhancer
Parses a string representation.

Specified by:
parse in interface IValueEnhancer

getIndex

public int getIndex()
Description copied from interface: IValueEnhancer
Unique ID for this enhancer.

Specified by:
getIndex in interface IValueEnhancer
Returns: