public final class rowid extends BaseDataType
Modifier and Type | Field and Description |
---|---|
private java.lang.Long |
value
Stores the integral row identifier, unique within a database
|
Constructor and Description |
---|
rowid()
Default constructor, creates an instance that represents the unknown
value.
|
rowid(BaseDataType value)
This is a special c'tor which should be used only when converting the
value returned by a function or method with polymorphic return type into the
expected type (i.e.
|
rowid(character val)
Constructs an instance given a character encoding (hex string in the
format 0xhhhhhhhhhhhhhhhh, where each h is an lower-case, hexadecimal
digit, limited to maximum 16 digits because that actual internal
implementation uses a java 64-bit Long).
|
rowid(java.lang.Long value)
Constructs an instance given a 64-bit integer value.
|
rowid(rowid value)
Constructs an instance based upon an existing instance.
|
rowid(java.lang.String val)
Constructs an instance given a character encoding (hex string in the
format 0xhhhhhhhhhhhhhhhh, where each h is an lower-case, hexadecimal
digit, limited to maximum 16 digits because that actual internal
implementation uses a java 64-bit Long).
|
Modifier and Type | Method and Description |
---|---|
void |
assign(BaseDataType value,
boolean force)
Sets the data of this instance based on the given instance.
|
void |
assign(rowid value)
Sets the data of this instance based on the given instance.
|
void |
assign(rowid value,
boolean force)
Sets the data of this instance based on the given instance.
|
void |
assign(Undoable value)
Sets the state (data and unknown value) of this instance based on the
state of the passed instance.
|
int |
compareTo(java.lang.Object obj)
Compares this instance with the specified instance and returns a -1
if this instance is less than the specified, 0 if the two instances
are equal and 1 if this instance is greater than the specified
instance.
|
java.lang.String |
defaultFormatString()
Return the default display format string for this type.
|
BaseDataType |
duplicate()
Does the same as standard
clone() method but returns an
instance of BaseDataType and doesn't throw the
CloneNotSupportedException . |
boolean |
equals(java.lang.Object o)
An equality test which handles the most common cases with the least
amount of overhead.
|
int |
formatLength(java.lang.String fmt)
Calculate the length of a formatted value (the text form of the value)
using this format string.
|
java.lang.Long |
getValue()
Returns the value of this instance as an
Long . |
int |
hashCode()
Hash code implementation which is consistent with
BaseDataType.equals(java.lang.Object) . |
BaseDataType |
instantiateUnknown()
Creates a new instance of the same type that represents the
unknown value . |
boolean |
isUnknown()
Determines if this instance represents the
unknown value . |
static java.lang.Long |
parseRowidString(java.lang.String val)
Worker method that parses and validates a
java.lang.String
according to rowid Progress data type constraints:
must start with "0x" prefix
must only contain lower-case hexadecimal digits
the length of string must be even (not mandatory 16 digits)
|
void |
readExternal(java.io.ObjectInput in)
Replacement for the default object reading method.
|
void |
setUnknown()
Sets this instance to represent the unknown value.
|
java.lang.String |
toString()
Creates a string representation of the instance data as a hex string
with a leading "0x" prefix.
|
java.lang.String |
toString(java.lang.String fmt)
Creates a string representation of the instance data as a hex string
with a leading "0x" prefix.
|
java.lang.String |
toStringExport()
Creates a string representation of the instance data using the 'export'
format.
|
java.lang.String |
toStringMessage()
Creates a string representation of the instance data in a form that is
compatible with the
MESSAGE language statement. |
void |
writeExternal(java.io.ObjectOutput out)
Replacement for the default object writing method.
|
assign, calcFormatLength, deepCopy, elementsOfType, generateDefault, generateUnknown, getTypeName, incompatibleTypesOnConversion, initializeDefaultExtent, instantiateDefault, instantiateDefaultExtent, isUnknownValue, maximum, minimum, notUnknownValue, sameType
changed, checkUndoable, checkUndoable, checkUndoable, getTransLevel, isGlobal, isUndoable, markUndoable, popBlock, rollback, setGlobal
private java.lang.Long value
public rowid()
public rowid(BaseDataType value)
assign(BaseDataType,boolean)
).value
- The value to be used for this instance.public rowid(rowid value)
value
- The instance to copy.public rowid(java.lang.Long value)
value
- 64-bit integer value; should be unique across all records in a
database. May be null
to indicate unknown value.public rowid(character val)
val
- A hex string in the format 0xhhhhhhhhhhhhhhhh.
Any other string will, including null
will
indicate the unknown value.public rowid(java.lang.String val)
val
- A hex string in the format 0xhhhhhhhhhhhhhhhh.
Any other string will, including null
will
indicate the unknown value.public static java.lang.Long parseRowidString(java.lang.String val)
java.lang.String
according to rowid Progress data type constraints:
Since this implementation of rowid
is not compatible with the
internal representations of Progress rowid
values, the only one
of the above constraints which we enforce here is the "0x" prefix.
The actual internal implementation warps around values above
Long.MAX_VALUE
and uses the negative interval of java long
type to store using all 64 bit available. Because of this rowids should
not be compared using <, >, ≤ or ≥.
The method will throw ErrorConditionException
if parsing
fails because the string exceeds the 64 bit bound of Long
data type (ie more than 16 hexadecimal digits).
Java language supports only signed primitive data type, so the
parsing utilities (Long.parseLong()
) are implemented that
way. Special code is needed to parse string values larger than
Long.MAX_VALUE
and to store within negative interval.
val
- A hex string in the format 0xhhhhhhhhhhhhhhhh.
Any other string will, including null
will
indicate the unknown value.Long
representing the internal value for a
rowid or null
if parsing fails.public BaseDataType instantiateUnknown()
unknown value
.instantiateUnknown
in class BaseDataType
unknown value
.public BaseDataType duplicate()
clone()
method but returns an
instance of BaseDataType
and doesn't throw the
CloneNotSupportedException
.duplicate
in class BaseDataType
public boolean equals(java.lang.Object o)
This implementation is consistent with hashCode()
.
equals
in class BaseDataType
o
- The instance to compare against.true
if the objects compare equivalently; false
if they do not,
or if the parameter is not a BaseDataType
instance.BaseDataType.equals(java.lang.Object)
public int hashCode()
BaseDataType.equals(java.lang.Object)
.hashCode
in class BaseDataType
public java.lang.Long getValue()
Long
.
If this instance represents the unknown value
, a
null
will be returned.
Long
or null
if
this is unknown
.public boolean isUnknown()
unknown value
.isUnknown
in class BaseDataType
true
if this instance is set to the
unknown value
.public void setUnknown()
Any existing value is discarded.
setUnknown
in class BaseDataType
public void assign(BaseDataType value, boolean force)
If the value is not of type rowid
, the following automatic type
conversion will occur:
This type support only rowid and unknown types (including unknown literal).
This variant is meant to handle the cases of built-in functions and methods in the 4GL which have polymorphic return types (e.g. DYNAMIC-FUNCTION()). This should NOT be used for non-polymorphic assignments.
assign
in class BaseDataType
value
- The instance from which to copy state.force
- Flag to indicate if a pending error should be ignored (see
ErrorManager.isPendingError()
and the assignment
forced regardless. Note that normal assignment silently
exits with no change if there is a pending error. If this
flag is true
, that check is bypassed and the
assignment will always be done.java.lang.ClassCastException
- if value
is not an instance of this class.public void assign(rowid value, boolean force)
value
- The instance from which to copy state.force
- Flag to indicate if a pending error should be ignored (see
ErrorManager.isPendingError()
and the assignment
forced regardless. Note that normal assignment silently
exits with no change if there is a pending error. If this
flag is true
, that check is bypassed and the
assignment will always be done.public void assign(rowid value)
This is a "no operation" in the case where silent error mode is active
AND an error has occurred in the current processing since the opening
call to ErrorManager.silentErrorEnable()
. This protection is
needed to ensure that the state of this instance does not change in
this case. This will not affect undo because that only occurs when
silent error mode is disabled.
value
- The instance from which to copy state.public void assign(Undoable value)
value
- The instance from which to copy state.public int compareTo(java.lang.Object obj)
Comparable
interface.
The rowids' internal, 64-bit integer values are compared.
obj
- The instance to compare against.unknown
.public java.lang.String toString()
If the instance represents the unknown value
, a '?' will be
returned.
toString
in class java.lang.Object
public java.lang.String toString(java.lang.String fmt)
If the instance represents the unknown value
, a '?' will be
returned.
toString
in class BaseDataType
fmt
- The Progress 4GL format string or null
if the
default format is to be used. This parameter is ignored.public java.lang.String toStringMessage()
MESSAGE
language statement. If the
instance represents the unknown value
, a '?' will be
returned.toStringMessage
in class BaseDataType
public java.lang.String toStringExport()
unknown value
, a
'?' will be returned.toStringExport
in class BaseDataType
public java.lang.String defaultFormatString()
null
, because there is no formatted
representation of a rowid: it must be converted to a string first using
the Progress STRING() function.defaultFormatString
in class BaseDataType
null
.public int formatLength(java.lang.String fmt)
formatLength
in class BaseDataType
fmt
- The format string.public void readExternal(java.io.ObjectInput in) throws java.io.IOException, java.lang.ClassNotFoundException
in
- The input source from which fields will be restored.java.io.IOException
- in case of I/O errors.java.lang.ClassNotFoundException
- if payload can't be instantiated.java.io.NotSerializableException
- always.public void writeExternal(java.io.ObjectOutput out) throws java.io.IOException
out
- The output destination to which fields will be saved.java.io.IOException
- in case of I/O errors.java.io.NotSerializableException
- always.