|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.avalon.framework.logger.AbstractLogEnabled
org.apache.avalon.excalibur.datasource.ids.AbstractIdGenerator
public abstract class AbstractIdGenerator
Field Summary | |
---|---|
private static java.math.BigDecimal |
BIG_DECIMAL_MAX_LONG
|
private java.lang.Object |
m_semaphore
Used to manage internal synchronization. |
private boolean |
m_useBigDecimals
Data type for the Id Pool. |
Fields inherited from interface org.apache.avalon.excalibur.datasource.ids.IdGenerator |
---|
ROLE |
Constructor Summary | |
---|---|
AbstractIdGenerator()
|
Method Summary | |
---|---|
java.math.BigDecimal |
getNextBigDecimalId()
Returns the next Id from the pool. |
protected abstract java.math.BigDecimal |
getNextBigDecimalIdInner()
Gets the next id as a Big Decimal. |
byte |
getNextByteId()
Returns the next Id from the pool. |
int |
getNextIntegerId()
Returns the next Id from the pool. |
long |
getNextLongId()
Returns the next Id from the pool. |
protected long |
getNextLongIdChecked(long maxId)
Gets the next Long Id constraining the value to be less than the specified maxId. |
protected abstract long |
getNextLongIdInner()
Gets the next id as a long. |
short |
getNextShortId()
Returns the next Id from the pool. |
protected boolean |
isUsingBigDecimals()
Returns true if the internal data type is using BigDecimals, false if it is using longs. |
protected void |
setUseBigDecimals(boolean useBigDecimals)
By default, the IdGenerator will operate using a backend datatype of type long. |
Methods inherited from class org.apache.avalon.framework.logger.AbstractLogEnabled |
---|
enableLogging, getLogger, setupLogger, setupLogger, setupLogger |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private static final java.math.BigDecimal BIG_DECIMAL_MAX_LONG
private java.lang.Object m_semaphore
private boolean m_useBigDecimals
Constructor Detail |
---|
public AbstractIdGenerator()
Method Detail |
---|
protected abstract java.math.BigDecimal getNextBigDecimalIdInner() throws IdException
IdException
- if an Id could not be allocated for any reason.protected abstract long getNextLongIdInner() throws IdException
IdException
- if an Id could not be allocated for any reason.protected final void setUseBigDecimals(boolean useBigDecimals)
useBigDecimals
- True to set BigDecimal as the internal data type.protected final boolean isUsingBigDecimals()
protected final long getNextLongIdChecked(long maxId) throws IdException
IdException
- if the next id is larger than the specified maxId.public final java.math.BigDecimal getNextBigDecimalId() throws IdException
getNextBigDecimalId
in interface IdGenerator
IdException
public final long getNextLongId() throws IdException
getNextLongId
in interface IdGenerator
IdException
- if the next id is outside of the range of valid longs.public final int getNextIntegerId() throws IdException
getNextIntegerId
in interface IdGenerator
IdException
- if the next id is outside of the range of valid integers.public final short getNextShortId() throws IdException
getNextShortId
in interface IdGenerator
IdException
- if the next id is outside of the range of valid shorts.public final byte getNextByteId() throws IdException
getNextByteId
in interface IdGenerator
IdException
- if the next id is outside of the range of valid bytes.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |