Class PersonIdent
java.lang.Object
org.eclipse.jgit.lib.PersonIdent
- All Implemented Interfaces:
Serializable
A combination of a person identity and time in Git.
Git combines Name + email + time + time zone to specify who wrote or
committed something.
- See Also:
-
Field Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionPersonIdent(String aName, String aEmailAddress) Construct a newPersonIdentwith current time.privatePersonIdent(String aName, String aEmailAddress, long when) PersonIdent(String aName, String aEmailAddress, long aWhen, int aTZ) Construct aPersonIdent.PersonIdent(String aName, String aEmailAddress, Date aWhen, TimeZone aTZ) Construct a PersonIdent from simple dataPersonIdent(String aName, String aEmailAddress, ProposedTimestamp when) Construct a newPersonIdentwith current time.Copy aPersonIdent.PersonIdent(PersonIdent pi, long aWhen, int aTZ) Copy a PersonIdent, but alter the clone's time stampPersonIdent(PersonIdent pi, Date aWhen) Copy aPersonIdent, but alter the clone's time stampPersonIdent(PersonIdent pi, Date when, TimeZone tz) Copy a PersonIdent, but alter the clone's time stampPersonIdent(Repository repo) Creates new PersonIdent from config info in repository, with current time.privatePersonIdent(UserConfig config) -
Method Summary
Modifier and TypeMethodDescriptionstatic voidappendSanitized(StringBuilder r, String str) Sanitize the given string for use in an identity and append to output.static voidappendTimezone(StringBuilder r, int offset) Format a timezone offset.booleanGet email address of persongetName()Get name of personGet this person's declared time zonestatic TimeZonegetTimeZone(int tzOffset) Get timezone object for the given offset.intGet this person's declared time zone as minutes east of UTC.getWhen()Get timestampinthashCode()Format for Git storage.toString()
-
Field Details
-
serialVersionUID
private static final long serialVersionUID- See Also:
-
name
-
emailAddress
-
when
private final long when -
tzOffset
private final int tzOffset
-
-
Constructor Details
-
PersonIdent
Creates new PersonIdent from config info in repository, with current time. This new PersonIdent gets the info from the default committer as available from the configuration.- Parameters:
repo- aRepositoryobject.
-
PersonIdent
-
PersonIdent
Construct a newPersonIdentwith current time. -
PersonIdent
Construct a newPersonIdentwith current time.- Parameters:
aName- aStringobject.aEmailAddress- aStringobject.when- aProposedTimestampobject.- Since:
- 4.6
-
PersonIdent
Copy a PersonIdent, but alter the clone's time stamp- Parameters:
pi- originalPersonIdentwhen- local timetz- time zone
-
PersonIdent
Copy aPersonIdent, but alter the clone's time stamp- Parameters:
pi- originalPersonIdentaWhen- local time
-
PersonIdent
-
PersonIdent
Copy a PersonIdent, but alter the clone's time stamp- Parameters:
pi- originalPersonIdentaWhen- local time stampaTZ- time zone
-
PersonIdent
-
PersonIdent
-
PersonIdent
Construct aPersonIdent.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 oftoExternalString()may not return an equivalent instance.
-
-
Method Details
-
getTimeZone
Get timezone object for the given offset.- Parameters:
tzOffset- timezone offset as ingetTimeZoneOffset().- Returns:
- time zone object for the given offset.
- Since:
- 4.1
-
appendTimezone
Format a timezone offset.- Parameters:
r- string builder to append to.offset- timezone offset as ingetTimeZoneOffset().- Since:
- 4.1
-
appendSanitized
Sanitize the given string for use in an identity and append to output.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 functionstrbuf_addstr_without_crud.- Parameters:
r- string builder to append to.str- input string.- Since:
- 4.4
-
getName
-
getEmailAddress
-
getWhen
-
getTimeZone
Get this person's declared time zone- Returns:
- this person's declared time zone; null if time zone is unknown.
-
getTimeZoneOffset
public int getTimeZoneOffset()Get this person's declared time zone as minutes east of UTC.- Returns:
- this person's declared time zone as minutes east of UTC. If the timezone is to the west of UTC it is negative.
-
hashCode
-
equals
-
toExternalString
-
toString
-