Package org.eclipse.mat.snapshot.model

## Class ObjectReference

- java.lang.Object
- - org.eclipse.mat.snapshot.model.ObjectReference

All Implemented Interfaces:
  `java.io.Serializable`

Direct Known Subclasses:
  `NamedReference`

    public class ObjectReference
    extends java.lang.Object
    implements java.io.Serializable

The value of a field if it is an object reference. Also can be used to retrieve an IObject from its address even if the object has not been indexed provided that the snapshot parser supports the reading of unindexed or discarded objects.

See Also:
  Serialized Form

### Constructor Summary

Constructors
`ObjectReference​(ISnapshot snapshot, long address)` Create a reference to an object based on its address but in a form where the object id can be found.

### Method Summary

All Methods Instance Methods Concrete Methods
`boolean` `equals​(java.lang.Object obj)`
`IObject` `getObject()` Get a detailed view of the object.
`long` `getObjectAddress()` The actual address of the object
`int` `getObjectId()` The id of the object
`int` `hashCode()`
`java.lang.String` `toString()` A simple view of the object as an address

### Methods inherited from class java.lang.Object

`getClass, notify, notifyAll, wait, wait, wait`

### Constructor Detail

#### ObjectReference

    public ObjectReference​(ISnapshot snapshot,
                           long address)

Create a reference to an object based on its address but in a form where the object id can be found.

Parameters:
  `snapshot` - the snapshot
  `address` - the address of the object

### Method Detail

#### getObjectAddress

    public long getObjectAddress()

The actual address of the object

Returns:
  the address

#### getObjectId

    public int getObjectId()
                    throws SnapshotException

The id of the object

Returns:
  the object id
Throws:
  `SnapshotException` - if the object has not been indexed, for example if it is unreachable or has been discarded.

#### getObject

    public IObject getObject()
                      throws SnapshotException

Get a detailed view of the object. Can be used to find an unindexed object by its addresss if the snapshot parser supports that.

Returns:
  the object detail
Throws:
  `SnapshotException` - if there is a problem retrieving the object

#### toString

    public java.lang.String toString()

A simple view of the object as an address

Overrides:
  `toString` in class `java.lang.Object`
Returns:
  the object address as a hexadecimal number.

#### hashCode

    public int hashCode()

Overrides:
  `hashCode` in class `java.lang.Object`

#### equals

    public boolean equals​(java.lang.Object obj)

Overrides:
  `equals` in class `java.lang.Object`