Package com.portal.bas
Class PModelHandle
java.lang.Object
com.portal.bas.PModelHandle
- All Implemented Interfaces:
Serializable
- Direct Known Subclasses:
PCollectingModelHandle
PModelHandle
passes a reference to a database object:
basically, a handle to an flist, whether that flist is an
opcode return value, a POID member of another
flist, a substruct, or an array element. Because it is a handle,
it may not have actually been read from the Portal database yet,
so calls to access fields must make a connection.
A model handle provides a hash value: however, it can also be typed
to indicate the type of the object it refers to. Also, when a model
handle is created from a POID, it is very useful to use the POID's
type as the handle's type and the POID's ID as the hash value. However,
the POID's ID is a different size than provided by Object.hashCode()
.
To re-create the original POID from the model handle, the full value is needed,
which is why there are two hash
methods included in this class.
- Version:
- 5
- Author:
- Larry Lynch-Freshner
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final int
static final int
static final int
static final String
A constant that provides a default value for creating an untyped model handle. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
Creates a model handle by assigning it a simple seed value.protected
Copies a model handle.protected
PModelHandle
(String type, long hash, boolean hashGiven, Object model) Initializes the model handle withtype
,hash
, andhashGiven
. -
Method Summary
Modifier and TypeMethodDescriptionboolean
OverridesObject.equals
.long
getHash()
Gets the actualhashCode
(a long).getModel()
getType()
Returns the type of model.int
hashCode()
Gets the hash value.boolean
Tests to determine if the handle was given the hash value to use.toString()
Gets a string representation of the model.
-
Field Details
-
UNTYPED
A constant that provides a default value for creating an untyped model handle.- See Also:
-
LOOKUP_UPDATE_IF_NEEDED
public static final int LOOKUP_UPDATE_IF_NEEDED- See Also:
-
LOOKUP_FORCE_UPDATE
public static final int LOOKUP_FORCE_UPDATE- See Also:
-
LOOKUP_DONT_UPDATE
public static final int LOOKUP_DONT_UPDATE- See Also:
-
-
Constructor Details
-
PModelHandle
protected PModelHandle()Creates a model handle by assigning it a simple seed value. -
PModelHandle
Copies a model handle.- Parameters:
mh
- the model handle to copy
-
PModelHandle
Initializes the model handle withtype
,hash
, andhashGiven
. This is the ctor that all other ctors call.
-
-
Method Details
-
getType
Returns the type of model. May correspond to database type.- Returns:
- A
String
that defines the type of model.
-
hashCode
public int hashCode()Gets the hash value. Called by collection using hashing. This produces a valid hash value even if the internal number is a different size. OverridesObject.hashCode()
. -
getHash
public long getHash()Gets the actualhashCode
(a long). This is usually called by the framework when re-creating a POID from a model handle.- Returns:
- The
hashCode
.
-
isGivenHash
public boolean isGivenHash()Tests to determine if the handle was given the hash value to use. For example, it returns true if the handle was created from a POID.- Returns:
- True if the handle was given the hash value to use; false otherwise.
-
getModel
-
equals
OverridesObject.equals
. Used as an equality test. -
toString
Gets a string representation of the model.
-