br.com.objectos.git
Class ObjectId

java.lang.Object
  extended by br.com.objectos.git.ObjectId
All Implemented Interfaces:
br.com.objectos.core.object.ToStringObject, MaybeObjectId

public final class ObjectId
extends Object
implements MaybeObjectId, br.com.objectos.core.object.ToStringObject

A hash value that uniquely identifies a Git object.

Since:
1

Method Summary
 boolean equals(Object obj)
          Compares the specified object with this Git object id for equality.
 void formatToString(StringBuilder toString, int level)
          Formats and appends to the toString builder at the specified indentation level a string representation of this id.
 String getHexString()
          Returns this id as a hex string.
 ObjectId getObjectId()
          Returns this reference.
 int hashCode()
          Returns the hash code value of this id.
 boolean isObjectId()
          Returns true.
static ObjectId parse(String id)
          Parses the specified text to produce a ObjectId instance.
 String print()
          Returns this id as a hex string.
 String toString()
          Returns the string representation of this id as defined by the ToStringObject.formatToString(StringBuilder, int) method.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Method Detail

parse

public static ObjectId parse(String id)
                      throws InvalidObjectIdFormatException
Parses the specified text to produce a ObjectId instance.

Parameters:
id - the text to be parsed
Returns:
a new ObjectId instance
Throws:
InvalidObjectIdFormatException - if the text could not be parsed

equals

public final boolean equals(Object obj)
Compares the specified object with this Git object id for equality.

Returns true if and only if the specified object is also a ObjectId and if both instances have the same hash value.

Overrides:
equals in class Object
Parameters:
obj - the object to be compared for equality with this object id
Returns:
true if the specified object is equal to this object id

formatToString

public final void formatToString(StringBuilder toString,
                                 int level)
Formats and appends to the toString builder at the specified indentation level a string representation of this id.

The string representation may contain:

Specified by:
formatToString in interface br.com.objectos.core.object.ToStringObject
Parameters:
toString - the builder of a toString method
level - the indentation level.

getHexString

public final String getHexString()
Returns this id as a hex string.

Returns:
this id as a hex string

getObjectId

public final ObjectId getObjectId()
Returns this reference.

Specified by:
getObjectId in interface MaybeObjectId
Returns:
this reference

hashCode

public final int hashCode()
Returns the hash code value of this id.

Overrides:
hashCode in class Object
Returns:
the hash code value of this id

isObjectId

public final boolean isObjectId()
Returns true.

Specified by:
isObjectId in interface MaybeObjectId
Returns:
true always

print

public final String print()
Returns this id as a hex string.

Returns:
this id as a hex string

toString

public final String toString()
Returns the string representation of this id as defined by the ToStringObject.formatToString(StringBuilder, int) method.

Overrides:
toString in class Object
Returns:
the string representation of this id


Copyright © 2020–2021 Objectos Software LTDA. All rights reserved.