public class PersonIdent
extends java.lang.Object
implements java.io.Serializable
Modifier and Type | Field and Description |
---|---|
private java.lang.String |
emailAddress |
private java.lang.String |
name |
private static long |
serialVersionUID |
private int |
tzOffset |
private long |
when |
Modifier | Constructor and Description |
---|---|
|
PersonIdent(PersonIdent pi)
Copy a
PersonIdent . |
|
PersonIdent(PersonIdent pi,
java.util.Date aWhen)
Copy a
PersonIdent , but alter the clone's
time stamp |
|
PersonIdent(PersonIdent pi,
java.util.Date when,
java.util.TimeZone tz)
Copy a PersonIdent, but alter the clone's time stamp
|
|
PersonIdent(PersonIdent pi,
long aWhen,
int aTZ)
Copy a PersonIdent, but alter the clone's time stamp
|
|
PersonIdent(Repository repo)
Creates new PersonIdent from config info in repository, with current time.
|
|
PersonIdent(java.lang.String aName,
java.lang.String aEmailAddress)
Construct a new
PersonIdent with current
time. |
|
PersonIdent(java.lang.String aName,
java.lang.String aEmailAddress,
java.util.Date aWhen,
java.util.TimeZone aTZ)
Construct a PersonIdent from simple data
|
private |
PersonIdent(java.lang.String aName,
java.lang.String aEmailAddress,
long when) |
|
PersonIdent(java.lang.String aName,
java.lang.String aEmailAddress,
long aWhen,
int aTZ)
Construct a
PersonIdent . |
|
PersonIdent(java.lang.String aName,
java.lang.String aEmailAddress,
ProposedTimestamp when)
Construct a new
PersonIdent with current
time. |
private |
PersonIdent(UserConfig config) |
Modifier and Type | Method and Description |
---|---|
static void |
appendSanitized(java.lang.StringBuilder r,
java.lang.String str)
Sanitize the given string for use in an identity and append to output.
|
static void |
appendTimezone(java.lang.StringBuilder r,
int offset)
Format a timezone offset.
|
boolean |
equals(java.lang.Object o) |
java.lang.String |
getEmailAddress()
Get email address of person
|
java.lang.String |
getName()
Get name of person
|
java.util.TimeZone |
getTimeZone()
Get this person's declared time zone
|
static java.util.TimeZone |
getTimeZone(int tzOffset)
Get timezone object for the given offset.
|
int |
getTimeZoneOffset()
Get this person's declared time zone as minutes east of UTC.
|
java.util.Date |
getWhen()
Get timestamp
|
int |
hashCode() |
java.lang.String |
toExternalString()
Format for Git storage.
|
java.lang.String |
toString() |
private static final long serialVersionUID
private final java.lang.String name
private final java.lang.String emailAddress
private final long when
private final int tzOffset
public PersonIdent(Repository repo)
repo
- a Repository
object.public PersonIdent(PersonIdent pi)
PersonIdent
.pi
- Original PersonIdent
public PersonIdent(java.lang.String aName, java.lang.String aEmailAddress)
PersonIdent
with current
time.aName
- a String
object.aEmailAddress
- a String
object.public PersonIdent(java.lang.String aName, java.lang.String aEmailAddress, ProposedTimestamp when)
PersonIdent
with current
time.aName
- a String
object.aEmailAddress
- a String
object.when
- a ProposedTimestamp
object.public PersonIdent(PersonIdent pi, java.util.Date when, java.util.TimeZone tz)
pi
- original PersonIdent
when
- local timetz
- time zonepublic PersonIdent(PersonIdent pi, java.util.Date aWhen)
PersonIdent
, but alter the clone's
time stamppi
- original PersonIdent
aWhen
- local timepublic PersonIdent(java.lang.String aName, java.lang.String aEmailAddress, java.util.Date aWhen, java.util.TimeZone aTZ)
aName
- a String
object.aEmailAddress
- a String
object.aWhen
- local time stampaTZ
- time zonepublic PersonIdent(PersonIdent pi, long aWhen, int aTZ)
pi
- original PersonIdent
aWhen
- local time stampaTZ
- time zoneprivate PersonIdent(java.lang.String aName, java.lang.String aEmailAddress, long when)
private PersonIdent(UserConfig config)
public PersonIdent(java.lang.String aName, java.lang.String aEmailAddress, long aWhen, int aTZ)
PersonIdent
.
Whitespace in the name and email is preserved for the lifetime of this
object, but are trimmed by toExternalString()
. This means that
parsing the result of toExternalString()
may not return an
equivalent instance.
aName
- a String
object.aEmailAddress
- a String
object.aWhen
- local time stampaTZ
- time zonepublic static java.util.TimeZone getTimeZone(int tzOffset)
tzOffset
- timezone offset as in getTimeZoneOffset()
.public static void appendTimezone(java.lang.StringBuilder r, int offset)
r
- string builder to append to.offset
- timezone offset as in getTimeZoneOffset()
.public static void appendSanitized(java.lang.StringBuilder r, java.lang.String str)
Trims whitespace from both ends and special characters \n < >
that
interfere with parsing; appends all other characters to the output.
Analogous to the C git function strbuf_addstr_without_crud
.
r
- string builder to append to.str
- input string.public java.lang.String getName()
public java.lang.String getEmailAddress()
public java.util.Date getWhen()
public java.util.TimeZone getTimeZone()
public int getTimeZoneOffset()
public int hashCode()
Hashcode is based only on the email address and timestamp.
hashCode
in class java.lang.Object
public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
public java.lang.String toExternalString()
public java.lang.String toString()
toString
in class java.lang.Object