com.versionone

## Class Oid

- java.lang.Object
- - com.versionone.Oid

-     public class Oid
      extends Object

  VersionOne object identifier

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static Oid` | `Null`
    `protected static String` | `NullOidToken`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `Oid(IAssetType assetType)` Create Object Identifier with just an AssetType
    `Oid(IAssetType assetType, DB.Int id, DB.Int moment)` Deprecated. use `Oid(com.versionone.apiclient.interfaces.IAssetType, int, int)`
    `Oid(IAssetType assetType, int id)` Create Object Identifier without moment
    `Oid(IAssetType assetType, int id, DB.Int moment)` Deprecated. use `Oid(com.versionone.apiclient.interfaces.IAssetType, int)`
    `Oid(IAssetType assetType, int id, int moment)` Create fully qualified object identifier

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `static boolean` | `compare(Oid lhs, Oid rhs)` Compare two oids
    `boolean` | `equals(Object obj)` Compare this instance to another oid
    `static Oid` | `fromToken(String oidtoken, IMetaModel meta)` Create an OID from a token
    `IAssetType` | `getAssetType()` Get the AssetType
    `Object` | `getKey()` Get the id for this instance
    `Object` | `getMoment()` get the moment for this oid
    `Oid` | `getMomentless()` Get this instance as a momentless oid
    `String` | `getToken()` Get the token for this object identifier
    `int` | `hashCode()` Get the hash code for the oid
    `boolean` | `hasMoment()` Does this instance contain a moment?
    `boolean` | `isNull()` Is this OID null
    `String` | `toString()` Object as string (the token)

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

      `clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

- - ### Field Detail

    - #### NullOidToken

          protected static final String NullOidToken

      See Also:
        Constant Field Values

    - #### Null

          public static final Oid Null

  - ### Constructor Detail

    - #### Oid

          public Oid(IAssetType assetType,
                     DB.Int id,
                     DB.Int moment)

      Deprecated. use `Oid(com.versionone.apiclient.interfaces.IAssetType, int, int)`
      Create fully qualified object identifier
      Parameters:
        `assetType` - - IAssetType
        `id` - - DB.Int
        `moment` - - DB.Int

    - #### Oid

          public Oid(IAssetType assetType,
                     int id,
                     DB.Int moment)

      Deprecated. use `Oid(com.versionone.apiclient.interfaces.IAssetType, int)`
      Create fully qualified object identifier
      Parameters:
        `assetType` - - IAssetType
        `id` - - int
        `moment` - - DB.Int

    - #### Oid

          public Oid(IAssetType assetType,
                     int id,
                     int moment)

      Create fully qualified object identifier
      Parameters:
        `assetType` - - IAssetType
        `id` - - int
        `moment` - - int

    - #### Oid

          public Oid(IAssetType assetType,
                     int id)

      Create Object Identifier without moment
      Parameters:
        `assetType` - - IAssetType
        `id` - - int

    - #### Oid

          public Oid(IAssetType assetType)

      Create Object Identifier with just an AssetType
      Parameters:
        `assetType` - - IAssetType

  - ### Method Detail

    - #### getAssetType

          public IAssetType getAssetType()

      Get the AssetType
      Returns:
        IAssetType for this OID

    - #### getKey

          public Object getKey()

      Get the id for this instance
      Returns:
        value as Integer

    - #### getMoment

          public Object getMoment()

      get the moment for this oid
      Returns:
        value as Integer or null

    - #### isNull

          public boolean isNull()

      Is this OID null
      Returns:
        true if it's null, false otherwise

    - #### getToken

          public String getToken()

      Get the token for this object identifier
      Returns:
        string containing token

    - #### toString

          public String toString()

      Object as string (the token)
      Overrides:
        `toString` in class `Object`

    - #### fromToken

          public static Oid fromToken(String oidtoken,
                                      IMetaModel meta)
                               throws OidException

      Create an OID from a token
      Parameters:
        `oidtoken` - - token to parse
        `meta` - - metamodel
      Returns:
        an Oid
      Throws:
        `OidException` - - if the OID cannot be created.

    - #### getMomentless

          public Oid getMomentless()

      Get this instance as a momentless oid
      Returns:
        - momentless OID

    - #### hasMoment

          public boolean hasMoment()

      Does this instance contain a moment?
      Returns:
        true if a moment exists, false otherwise

    - #### equals

          public boolean equals(Object obj)

      Compare this instance to another oid
      Overrides:
        `equals` in class `Object`

    - #### hashCode

          public int hashCode()

      Get the hash code for the oid
      Overrides:
        `hashCode` in class `Object`

    - #### compare

          public static boolean compare(Oid lhs,
                                        Oid rhs)

      Compare two oids
      Parameters:
        `lhs` - - left hand side
        `rhs` - - right hand side
      Returns:
        true if these are equal; false otherwise

Copyright © 2021 VersionOne, Inc.. All rights reserved.