Berkeley DB Java Edition
version 4.1.6

com.sleepycat.je
Class SequenceConfig

java.lang.Object
  extended by com.sleepycat.je.SequenceConfig
All Implemented Interfaces:
Cloneable

public class SequenceConfig
extends Object
implements Cloneable

Specifies the attributes of a sequence.


Field Summary
static SequenceConfig DEFAULT
          Default configuration used if null is passed to methods that create a cursor.
 
Constructor Summary
SequenceConfig()
          An instance created using the default constructor is initialized with the system's default settings.
 
Method Summary
 SequenceConfig clone()
          Returns a copy of this configuration object.
 boolean getAllowCreate()
          Returns true if the Database.openSequence method is configured to create the sequence if it does not already exist.
 boolean getAutoCommitNoSync()
          Returns true if the auto-commit operations on the sequence are configure to not flush the transaction log..
 int getCacheSize()
          Returns the number of elements cached by a sequence handle..
 boolean getDecrement()
          Returns true if the sequence is configured to decrement.
 boolean getExclusiveCreate()
          Returns true if the Database.openSequence method is configured to fail if the database already exists.
 long getInitialValue()
          Returns the initial value for a sequence..
 long getRangeMax()
          Returns the maximum value for the sequence.
 long getRangeMin()
          Returns the minimum value for the sequence.
 boolean getWrap()
          Returns true if the sequence will wrap around when it is incremented (decremented) past the specified maximum (minimum) value.
 SequenceConfig setAllowCreate(boolean allowCreate)
          Configures the Database.openSequence method to create the sequence if it does not already exist.
 SequenceConfig setAutoCommitNoSync(boolean autoCommitNoSync)
          Configures auto-commit operations on the sequence to not flush the transaction log.
 SequenceConfig setCacheSize(int cacheSize)
          Set the Configure the number of elements cached by a sequence handle.
 SequenceConfig setDecrement(boolean decrement)
          Specifies that the sequence should be decremented.
 SequenceConfig setExclusiveCreate(boolean exclusiveCreate)
          Configures the Database.openSequence method to fail if the database already exists.
 SequenceConfig setInitialValue(long initialValue)
          Sets the initial value for a sequence.
 SequenceConfig setRange(long min, long max)
          Configures a sequence range.
 SequenceConfig setWrap(boolean wrap)
          Specifies that the sequence should wrap around when it is incremented (decremented) past the specified maximum (minimum) value.
 String toString()
          Returns the values for each configuration attribute.
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

DEFAULT

public static final SequenceConfig DEFAULT
Default configuration used if null is passed to methods that create a cursor.

Constructor Detail

SequenceConfig

public SequenceConfig()
An instance created using the default constructor is initialized with the system's default settings.

Method Detail

setAllowCreate

public SequenceConfig setAllowCreate(boolean allowCreate)
Configures the Database.openSequence method to create the sequence if it does not already exist.

The default value is false.

This method may be called at any time during the life of the application.

Parameters:
allowCreate - If true, configure the Database.openSequence method to create the sequence if it does not already exist.
Returns:
this

getAllowCreate

public boolean getAllowCreate()
Returns true if the Database.openSequence method is configured to create the sequence if it does not already exist.

This method may be called at any time during the life of the application.

Returns:
true if the Database.openSequence method is configured to create the sequence if it does not already exist.

setCacheSize

public SequenceConfig setCacheSize(int cacheSize)
Set the Configure the number of elements cached by a sequence handle.

The default value is zero.

This method may be called at any time during the life of the application.

Parameters:
cacheSize - The number of elements cached by a sequence handle. May not be larger than the size of the range defined by setRange(long, long).
Returns:
this

getCacheSize

public int getCacheSize()
Returns the number of elements cached by a sequence handle..

This method may be called at any time during the life of the application.

Returns:
The number of elements cached by a sequence handle..

setDecrement

public SequenceConfig setDecrement(boolean decrement)
Specifies that the sequence should be decremented.

The default value is false.

This method may be called at any time during the life of the application.

Parameters:
decrement - If true, specify that the sequence should be decremented.
Returns:
this

getDecrement

public boolean getDecrement()
Returns true if the sequence is configured to decrement.

This method may be called at any time during the life of the application.

Returns:
true if the sequence is configured to decrement.

setExclusiveCreate

public SequenceConfig setExclusiveCreate(boolean exclusiveCreate)
Configures the Database.openSequence method to fail if the database already exists.

The default value is false.

This method may be called at any time during the life of the application.

Parameters:
exclusiveCreate - If true, configure the Database.openSequence method to fail if the database already exists.
Returns:
this

getExclusiveCreate

public boolean getExclusiveCreate()
Returns true if the Database.openSequence method is configured to fail if the database already exists.

This method may be called at any time during the life of the application.

Returns:
true if the Database.openSequence method is configured to fail if the database already exists.

setInitialValue

public SequenceConfig setInitialValue(long initialValue)
Sets the initial value for a sequence.

The default initial value is zero.

This call is only effective when the sequence is being created.

This method may be called at any time during the life of the application.

Parameters:
initialValue - The initial value for a sequence. Must be within the range minimum and maximum values, inclusive.
Returns:
this

getInitialValue

public long getInitialValue()
Returns the initial value for a sequence..

This method may be called at any time during the life of the application.

Returns:
The initial value for a sequence..

setAutoCommitNoSync

public SequenceConfig setAutoCommitNoSync(boolean autoCommitNoSync)
Configures auto-commit operations on the sequence to not flush the transaction log.

The default value is false.

This method may be called at any time during the life of the application.

Parameters:
autoCommitNoSync - If true, configure auto-commit operations on the sequence to not flush the transaction log.
Returns:
this

getAutoCommitNoSync

public boolean getAutoCommitNoSync()
Returns true if the auto-commit operations on the sequence are configure to not flush the transaction log..

This method may be called at any time during the life of the application.

Returns:
true if the auto-commit operations on the sequence are configure to not flush the transaction log..

setRange

public SequenceConfig setRange(long min,
                               long max)
Configures a sequence range. This call is only effective when the sequence is being created.

The default minimum is Long.MIN_VALUE and the default maximum is Long.MAX_VALUE.

Parameters:
min - The minimum value for the sequence. Must be less than max.
max - The maximum value for the sequence. Must be greater than min.
Returns:
this

getRangeMin

public long getRangeMin()
Returns the minimum value for the sequence.

This method may be called at any time during the life of the application.

Returns:
The minimum value for the sequence.

getRangeMax

public long getRangeMax()
Returns the maximum value for the sequence.

This method may be called at any time during the life of the application.

Returns:
The maximum value for the sequence.

setWrap

public SequenceConfig setWrap(boolean wrap)
Specifies that the sequence should wrap around when it is incremented (decremented) past the specified maximum (minimum) value.

The default value is false.

This method may be called at any time during the life of the application.

Parameters:
wrap - If true, specify that the sequence should wrap around when it is incremented (decremented) past the specified maximum (minimum) value.
Returns:
this

getWrap

public boolean getWrap()
Returns true if the sequence will wrap around when it is incremented (decremented) past the specified maximum (minimum) value.

This method may be called at any time during the life of the application.

Returns:
true if the sequence will wrap around when it is incremented (decremented) past the specified maximum (minimum) value.

clone

public SequenceConfig clone()
Returns a copy of this configuration object.

Overrides:
clone in class Object

toString

public String toString()
Returns the values for each configuration attribute.

Overrides:
toString in class Object
Returns:
the values for each configuration attribute.

Berkeley DB Java Edition
version 4.1.6

Copyright (c) 2004-2010 Oracle. All rights reserved.