br.com.objectos.git
Class Identification

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

public final class Identification
extends Object
implements br.com.objectos.core.object.ToStringObject

The author or the commiter field of a commit object. Consists of the combination of the name + e-mail + time + time zone.

Since:
1

Method Summary
 boolean equals(Object obj)
          Compares the specified object with this identification 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 getEmail()
          Returns the e-mail addresss associated with this identification.
 String getGitTimeZone()
          Returns the string representation of the timezone associated with this identification.
 String getName()
          Returns the name associated with this identification.
 long getSeconds()
          Returns the date, as seconds since UNIX epoch, associated with this identification.
 int hashCode()
          Returns the hash code value of this identification.
 String print()
          Returns a string representation of the form name <email> seconds timezone.
 void setEmail(String newEmail)
          Deprecated. this class will be immutable in a future release. Please use withIdentity(String, String).
 void setName(String newName)
          Deprecated. this class will be immutable in a future release. Please use withIdentity(String, String).
 String toString()
          Returns the string representation of this identification as defined by the ToStringObject.formatToString(StringBuilder, int) method.
 Identification withIdentity(String newName, String newEmail)
          Returns a copy of this identification with both the name and the e-mail altered.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Method Detail

equals

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

Returns true if and only if the specified object is also a Identification instance and if both instances have the same email, time zone, name and timestamp.

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

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.

getEmail

public final String getEmail()
Returns the e-mail addresss associated with this identification.

Returns:
the e-mail addresss associated with this identification

getGitTimeZone

public final String getGitTimeZone()
Returns the string representation of the timezone associated with this identification.

Returns:
the timezone associated with this identification

getName

public final String getName()
Returns the name associated with this identification.

Returns:
the name associated with this identification

getSeconds

public final long getSeconds()
Returns the date, as seconds since UNIX epoch, associated with this identification.

Returns:
the date, as seconds since UNIX epoch, associated with this identification

hashCode

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

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

print

public final String print()
Returns a string representation of the form name <email> seconds timezone.

Returns:
a string representation

setEmail

@Deprecated
public final void setEmail(String newEmail)
Deprecated. this class will be immutable in a future release. Please use withIdentity(String, String).

Sets the e-mail address value.

Parameters:
newEmail - the new e-mail address value

setName

@Deprecated
public final void setName(String newName)
Deprecated. this class will be immutable in a future release. Please use withIdentity(String, String).

Sets the name value.

Parameters:
newName - the new name value

toString

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

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

withIdentity

public final Identification withIdentity(String newName,
                                         String newEmail)
Returns a copy of this identification with both the name and the e-mail altered.

Parameters:
newName - the name of the returned copy
newEmail - the e-mail address of the returned copy
Returns:
a copy of this identification with both the name and the e-mail altered
Since:
3


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