asObject

asObject(): Object;

The asObject method of the String primitive type returns an object reference based on the contents of the oid-like receiving string based on class numbers, followed by an optional lifetime indication.

This method is the inverse of the Object class getObjectStringForObject method.

The form of the oid-like string can be one of the following.

The optional lifetime can be '(t)', to indicate a transient object, or '(s)', to indicate a shared transient object. If the optional lifetime is absent, it indicates a persistent object.

The following code fragments are examples of the use of the asObject method.

// return persistent instance of class number 16401
obj := '16401.1'.asObject;
// return transient instance of class number 16401
obj := '16401.1 (t)'.asObject;
// return shared transient instance of class number 16401
obj := '16401.1 (s)'.asObject;

The asObject method is useful for debugging from a Workspace method to inspect a specific oid; for example, an oid returned in an exception dialog.

For details about returning an object reference based on the contents of the receiving string, see the String primitive type asOid method.