Package org.h2.command.ddl

# Class SequenceOptions

java.lang.Object
org.h2.command.ddl.SequenceOptions

public class SequenceOptions extends Object
Sequence options.

## Constructor Summary

Constructors
Constructor
Description
`SequenceOptions()`
Creates new instance of sequence options.
`SequenceOptions(Sequence oldSequence, TypeInfo dataType)`
Creates new instance of sequence options.

## Method Summary

Modifier and Type
Method
Description
`long[]`
`getBounds()`
`static long[]`
`getBounds(TypeInfo dataType)`
Get the bounds (min, max) of a data type.
`Long`
`getCacheSize(SessionLocal session)`
Gets cache size.
`Sequence.Cycle`
`getCycle()`
Gets cycle option.
`TypeInfo`
`getDataType()`
`Long`
`getIncrement(SessionLocal session)`
Gets increment value.
`Long`
`getMaxValue(Sequence sequence, SessionLocal session)`
Gets max value.
`Long`
`getMinValue(Sequence sequence, SessionLocal session)`
Gets min value.
`Long`
`getRestartValue(SessionLocal session, long startValue)`
Gets restart value.
`Long`
`getStartValue(SessionLocal session)`
Gets start value.
`void`
`setCacheSize(Expression cacheSize)`
Sets cache size.
`void`
`setCycle(Sequence.Cycle cycle)`
Sets cycle option.
`void`
`setDataType(TypeInfo dataType)`
`void`
`setIncrement(Expression increment)`
Sets increment value expression.
`void`
`setMaxValue(Expression maxValue)`
Sets max value expression.
`void`
`setMinValue(Expression minValue)`
Sets min value expression.
`void`
`setRestartValue(Expression restart)`
Sets restart value expression, or `ValueExpression.DEFAULT`.
`void`
`setStartValue(Expression start)`
Sets start value expression.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Constructor Details

### SequenceOptions

public SequenceOptions()
Creates new instance of sequence options.

### SequenceOptions

public SequenceOptions(Sequence oldSequence, TypeInfo dataType)
Creates new instance of sequence options.

Parameters:
  `oldSequence` - the sequence to copy options from
  `dataType` - the new data type

## Method Details

### getDataType

public TypeInfo getDataType()

### setDataType

public void setDataType(TypeInfo dataType)

### getStartValue

public Long getStartValue(SessionLocal session)
Gets start value.

Parameters:
  `session` - The session to calculate the value.
Returns:
  start value or `null` if value is not defined.

### setStartValue

public void setStartValue(Expression start)
Sets start value expression.

Parameters:
  `start` - START WITH value expression.

### getRestartValue

public Long getRestartValue(SessionLocal session, long startValue)
Gets restart value.

Parameters:
  `session` - the session to calculate the value
  `startValue` - the start value to use if restart without value is specified
Returns:
  restart value or `null` if value is not defined.

### setRestartValue

public void setRestartValue(Expression restart)
Sets restart value expression, or `ValueExpression.DEFAULT`.

Parameters:
  `restart` - RESTART WITH value expression, or `ValueExpression.DEFAULT` for simple RESTART

### getIncrement

public Long getIncrement(SessionLocal session)
Gets increment value.

Parameters:
  `session` - The session to calculate the value.
Returns:
  increment value or `null` if value is not defined.

### setIncrement

public void setIncrement(Expression increment)
Sets increment value expression.

Parameters:
  `increment` - INCREMENT BY value expression.

### getMaxValue

public Long getMaxValue(Sequence sequence, SessionLocal session)
Gets max value.

Parameters:
  `sequence` - the sequence to get default max value.
  `session` - The session to calculate the value.
Returns:
  max value when the MAXVALUE expression is set, otherwise returns default max value.

### setMaxValue

public void setMaxValue(Expression maxValue)
Sets max value expression.

Parameters:
  `maxValue` - MAXVALUE expression.

### getMinValue

public Long getMinValue(Sequence sequence, SessionLocal session)
Gets min value.

Parameters:
  `sequence` - the sequence to get default min value.
  `session` - The session to calculate the value.
Returns:
  min value when the MINVALUE expression is set, otherwise returns default min value.

### setMinValue

public void setMinValue(Expression minValue)
Sets min value expression.

Parameters:
  `minValue` - MINVALUE expression.

### getBounds

public long[] getBounds()

### getBounds

public static long[] getBounds(TypeInfo dataType)
Get the bounds (min, max) of a data type.

Parameters:
  `dataType` - the data type
Returns:
  the bounds (an array with 2 elements)

### getCycle

public Sequence.Cycle getCycle()
Gets cycle option.

Returns:
  cycle option value or `null` if is not defined.

### setCycle

public void setCycle(Sequence.Cycle cycle)
Sets cycle option.

Parameters:
  `cycle` - option value.

### getCacheSize

public Long getCacheSize(SessionLocal session)
Gets cache size.

Parameters:
  `session` - The session to calculate the value.
Returns:
  cache size or `null` if value is not defined.

### setCacheSize

public void setCacheSize(Expression cacheSize)
Sets cache size.

Parameters:
  `cacheSize` - cache size.