Package org.hibernate.id
Class IdentifierGeneratorHelper.BasicHolder
- java.lang.Object
-
- org.hibernate.id.IdentifierGeneratorHelper.BasicHolder
-
- All Implemented Interfaces:
java.io.Serializable
,IntegralDataTypeHolder
- Enclosing class:
- IdentifierGeneratorHelper
public static class IdentifierGeneratorHelper.BasicHolder extends java.lang.Object implements IntegralDataTypeHolder
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description BasicHolder(java.lang.Class exactType)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description IntegralDataTypeHolder
add(long addend)
Perform an additionvoid
bind(java.sql.PreparedStatement preparedStatement, int position)
Bind this holders internal value to the given result set.IntegralDataTypeHolder
copy()
Make a copy of this holder.IntegralDataTypeHolder
decrement()
Equivalent to a -- operationboolean
eq(long value)
Perform an equality comparison checkboolean
eq(IntegralDataTypeHolder other)
Perform an equality comparison checkboolean
equals(java.lang.Object o)
long
getActualLongValue()
boolean
gt(long value)
Perform a "greater than" comparison check.boolean
gt(IntegralDataTypeHolder other)
Perform a "greater than" comparison check.int
hashCode()
IntegralDataTypeHolder
increment()
Equivalent to a ++ operationIntegralDataTypeHolder
initialize(long value)
Initialize the internal value from the given primitive long.IntegralDataTypeHolder
initialize(java.sql.ResultSet resultSet, long defaultValue)
Initialize the internal value from the given result set, using the specified default value if we could not get a value from the result set (aka result was null).boolean
lt(long value)
Perform a "less than" comparison check.boolean
lt(IntegralDataTypeHolder other)
Perform a "less than" comparison check.java.lang.Number
makeValue()
Return the internal value.java.lang.Number
makeValueThenAdd(long addend)
Increment the internal state by the given addend, but return the pre-incremented value.java.lang.Number
makeValueThenIncrement()
Increment the internal state, but return the pre-incremented value.IntegralDataTypeHolder
multiplyBy(long factor)
Perform a multiplication.IntegralDataTypeHolder
multiplyBy(IntegralDataTypeHolder factor)
Perform a multiplication.IntegralDataTypeHolder
subtract(long subtrahend)
Perform a subtractionjava.lang.String
toString()
-
-
-
Method Detail
-
getActualLongValue
public long getActualLongValue()
-
initialize
public IntegralDataTypeHolder initialize(long value)
Description copied from interface:IntegralDataTypeHolder
Initialize the internal value from the given primitive long.- Specified by:
initialize
in interfaceIntegralDataTypeHolder
- Parameters:
value
- The primitive integral value.- Returns:
- this, for method chaining
-
initialize
public IntegralDataTypeHolder initialize(java.sql.ResultSet resultSet, long defaultValue) throws java.sql.SQLException
Description copied from interface:IntegralDataTypeHolder
Initialize the internal value from the given result set, using the specified default value if we could not get a value from the result set (aka result was null).- Specified by:
initialize
in interfaceIntegralDataTypeHolder
- Parameters:
resultSet
- The JDBC result setdefaultValue
- The default value to use if we did not get a result set value.- Returns:
- this, for method chaining
- Throws:
java.sql.SQLException
- Any exception from accessing the result set
-
bind
public void bind(java.sql.PreparedStatement preparedStatement, int position) throws java.sql.SQLException
Description copied from interface:IntegralDataTypeHolder
Bind this holders internal value to the given result set.- Specified by:
bind
in interfaceIntegralDataTypeHolder
- Parameters:
preparedStatement
- The JDBC prepared statementposition
- The position at which to bind- Throws:
java.sql.SQLException
- Any exception from accessing the statement
-
increment
public IntegralDataTypeHolder increment()
Description copied from interface:IntegralDataTypeHolder
Equivalent to a ++ operation- Specified by:
increment
in interfaceIntegralDataTypeHolder
- Returns:
- this, for method chaining
-
add
public IntegralDataTypeHolder add(long addend)
Description copied from interface:IntegralDataTypeHolder
Perform an addition- Specified by:
add
in interfaceIntegralDataTypeHolder
- Parameters:
addend
- The value to add to this integral.- Returns:
- this, for method chaining
-
decrement
public IntegralDataTypeHolder decrement()
Description copied from interface:IntegralDataTypeHolder
Equivalent to a -- operation- Specified by:
decrement
in interfaceIntegralDataTypeHolder
- Returns:
- this, for method chaining
-
subtract
public IntegralDataTypeHolder subtract(long subtrahend)
Description copied from interface:IntegralDataTypeHolder
Perform a subtraction- Specified by:
subtract
in interfaceIntegralDataTypeHolder
- Parameters:
subtrahend
- The value to subtract from this integral.- Returns:
- this, for method chaining
-
multiplyBy
public IntegralDataTypeHolder multiplyBy(IntegralDataTypeHolder factor)
Description copied from interface:IntegralDataTypeHolder
Perform a multiplication.- Specified by:
multiplyBy
in interfaceIntegralDataTypeHolder
- Parameters:
factor
- The factor by which to multiple this integral- Returns:
- this, for method chaining
-
multiplyBy
public IntegralDataTypeHolder multiplyBy(long factor)
Description copied from interface:IntegralDataTypeHolder
Perform a multiplication.- Specified by:
multiplyBy
in interfaceIntegralDataTypeHolder
- Parameters:
factor
- The factor by which to multiple this integral- Returns:
- this, for method chaining
-
eq
public boolean eq(IntegralDataTypeHolder other)
Description copied from interface:IntegralDataTypeHolder
Perform an equality comparison check- Specified by:
eq
in interfaceIntegralDataTypeHolder
- Parameters:
other
- The other value to check against our internal state- Returns:
- True if the two are equal
-
eq
public boolean eq(long value)
Description copied from interface:IntegralDataTypeHolder
Perform an equality comparison check- Specified by:
eq
in interfaceIntegralDataTypeHolder
- Parameters:
value
- The other value to check against our internal state- Returns:
- True if the two are equal
-
lt
public boolean lt(IntegralDataTypeHolder other)
Description copied from interface:IntegralDataTypeHolder
Perform a "less than" comparison check. We check to see if our value is less than the incoming value...- Specified by:
lt
in interfaceIntegralDataTypeHolder
- Parameters:
other
- The other value to check against our internal state- Returns:
- True if our value is less than the 'other' value.
-
lt
public boolean lt(long value)
Description copied from interface:IntegralDataTypeHolder
Perform a "less than" comparison check. We check to see if our value is less than the incoming value...- Specified by:
lt
in interfaceIntegralDataTypeHolder
- Parameters:
value
- The other value to check against our internal state- Returns:
- True if our value is less than the 'other' value.
-
gt
public boolean gt(IntegralDataTypeHolder other)
Description copied from interface:IntegralDataTypeHolder
Perform a "greater than" comparison check. We check to see if our value is greater than the incoming value...- Specified by:
gt
in interfaceIntegralDataTypeHolder
- Parameters:
other
- The other value to check against our internal state- Returns:
- True if our value is greater than the 'other' value.
-
gt
public boolean gt(long value)
Description copied from interface:IntegralDataTypeHolder
Perform a "greater than" comparison check. We check to see if our value is greater than the incoming value...- Specified by:
gt
in interfaceIntegralDataTypeHolder
- Parameters:
value
- The other value to check against our internal state- Returns:
- True if our value is greater than the 'other' value.
-
copy
public IntegralDataTypeHolder copy()
Description copied from interface:IntegralDataTypeHolder
Make a copy of this holder.- Specified by:
copy
in interfaceIntegralDataTypeHolder
- Returns:
- The copy.
-
makeValue
public java.lang.Number makeValue()
Description copied from interface:IntegralDataTypeHolder
Return the internal value.- Specified by:
makeValue
in interfaceIntegralDataTypeHolder
- Returns:
- The current internal value
-
makeValueThenIncrement
public java.lang.Number makeValueThenIncrement()
Description copied from interface:IntegralDataTypeHolder
Increment the internal state, but return the pre-incremented value.- Specified by:
makeValueThenIncrement
in interfaceIntegralDataTypeHolder
- Returns:
- The pre-incremented internal value
-
makeValueThenAdd
public java.lang.Number makeValueThenAdd(long addend)
Description copied from interface:IntegralDataTypeHolder
Increment the internal state by the given addend, but return the pre-incremented value.- Specified by:
makeValueThenAdd
in interfaceIntegralDataTypeHolder
- Parameters:
addend
- The value to be added to our internal state- Returns:
- The pre-incremented internal value
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equals
in classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
-