public class IntegerId extends AbstractValue implements StatePreserving
getNextId().PropertyResources.Load, PropertyResources.URLResource| Modifier and Type | Field and Description |
|---|---|
private static int |
DEFMAXID
Maximum value, defaults to Integer.MAX_VALUE
|
private static int |
DEFSTARTID
Start value, defaults to 1.
|
private int |
id
The current value.
|
static String |
KEY_MAXID
Maximum value, defaults to Integer.MAX_VALUE
|
static String |
KEY_STARTID
Start value, defaults to 1.
|
KEY_FORMAT, KEY_NAME, KEY_PRESERVE, UNKNOWNKEY_NOINITONCREATE, POSTFIX_ALPHABET, POSTFIX_BYTES, POSTFIX_DIR, POSTFIX_EXT, POSTFIX_FILE, POSTFIX_LIST, POSTFIX_MODTIME, POSTFIX_URLKEY_LISTSEPARATOR, KEY_MAPKEYVALUECHAR, KEY_MAPSEPARATORCONFIG, KEY_CLASSKEY_URLRESOURCES, KEY_URLUSECONFIG, KEY_URLUSECURRENT, KEY_URLUSEHOME| Constructor and Description |
|---|
IntegerId()
Defaults all.
|
IntegerId(Map<String,String> prop)
Constructs a new IntegerId.
|
| Modifier and Type | Method and Description |
|---|---|
int |
getNextId()
Returns the next id readily as an integer.
|
Number |
getValue()
Gets the current unique name identifier.
|
void |
init()
We scout for a file that hold the last unique value.
|
boolean |
preserve()
On exit, we save our current state if the serialize property is set.
|
boolean |
restore()
We restore our old value by reading the last date and target count from
a serialization file.
|
Number |
setValue(Number val)
Setting the unique number is only allowed vai a call to next,
therefore this method throws an UnsupportedOperationException.
|
get, setcreateParameter, delivers, exit, getFormatted, getFormatted, getName, getPreserveFile, getString, getString, overrideDefaultName, register, rescanned, setName, toStringclone, createFrom, createFrom, createFrom, createInstance, getApplet, getAsResources, getLocate, getPropertiesToKey, getPropertiesToKey, getResource, getResourceAsStream, getResourceFromKey, getResources, hasLocalURLs, initProperties, keyCreate, keyCreate, reload, setAppletaugment, augment, augment, augment, augment, defaultBoolean, defaultChar, defaultDouble, defaultFloat, defaultInt, defaultLong, defaultObject, defaultObject, defaultProperties, defaultProperty, getAsBoolean, getAsChar, getAsDouble, getAsEnums, getAsFloat, getAsInt, getAsList, getAsLong, getAsMap, getAsMap, getAsObject, getAsObject, getProperties, getProperty, has, isNew, parseObject, parseObject, reload, removeProperty, requires, setObject, setProperties, setProperty, stringPropertiesequals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitdefaultBoolean, defaultChar, defaultDouble, defaultFloat, defaultInt, defaultLong, defaultObject, defaultObject, defaultProperties, defaultProperty, getAsBoolean, getAsChar, getAsDouble, getAsFloat, getAsInt, getAsList, getAsLong, getAsMap, getAsObject, getAsObject, getProperties, getProperty, has, parseObject, removeProperty, setObject, setProperty, stringPropertiesexitpublic static final String KEY_STARTID
public static final String KEY_MAXID
private static final int DEFSTARTID
private static final int DEFMAXID
private int id
public void init()
throws InitException
init in interface Initializableinit in class AbstractParameterInitExceptionpublic boolean restore()
restore in interface Preservingpublic boolean preserve()
preserve in interface Preservingpublic Number getValue()
public Number setValue(Number val) throws UnsupportedOperationException
setValue in interface ValueUnsupportedOperationExceptionpublic int getNextId()