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:
-
Constructor Summary
ConstructorsConstructorDescriptionPersonIdent(String aName, String aEmailAddress) Construct a newPersonIdentwith current time.PersonIdent(String aName, String aEmailAddress, long aWhen, int aTZ) Deprecated.Use the variant with Instant and ZoneId insteadPersonIdent(String aName, String aEmailAddress, Instant aWhen, ZoneId zoneId) Construct a PersonIdent from simple dataPersonIdent(String aName, String aEmailAddress, Date aWhen, TimeZone aTZ) Deprecated.Use the variant with Instant and ZoneId insteadPersonIdent(String aName, String aEmailAddress, ProposedTimestamp when) Construct a newPersonIdentwith current time.Copy aPersonIdent.PersonIdent(PersonIdent pi, long aWhen, int aTZ) Deprecated.Use the variant with Instant and ZoneId insteadPersonIdent(PersonIdent pi, Instant aWhen) Copy aPersonIdent, but alter the clone's time stampPersonIdent(PersonIdent pi, Instant when, ZoneId tz) Copy a PersonIdent, but alter the clone's time stampPersonIdent(PersonIdent pi, Date aWhen) Deprecated.Use the variant with an Instant insteadPersonIdent(PersonIdent pi, Date when, TimeZone tz) Deprecated.UsePersonIdent(PersonIdent, Instant, ZoneId)instead.PersonIdent(Repository repo) Creates new PersonIdent from config info in repository, with current time. -
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 personDeprecated.Use getZoneId insteadstatic TimeZonegetTimeZone(int tzOffset) Get timezone object for the given offset.intDeprecated.UsegetZoneOffset()and read minutes from theregetWhen()Deprecated.Use getWhenAsInstant insteadGet when attribute as instantGet the time zone idstatic ZoneIdgetZoneId(int tzOffset) Translate a minutes offset into a ZoneIdReturn the offset in this timezone at the specific timeinthashCode()Format for Git storage.toString()
-
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
Copy aPersonIdent.- Parameters:
pi- OriginalPersonIdent
-
PersonIdent
Construct a newPersonIdentwith current time. -
PersonIdent
Construct a newPersonIdentwith current time.- Parameters:
aName- aStringobject.aEmailAddress- aStringobject.when- aProposedTimestampobject.- Since:
- 4.6
-
PersonIdent
Deprecated.UsePersonIdent(PersonIdent, Instant, ZoneId)instead.Copy a PersonIdent, but alter the clone's time stamp- Parameters:
pi- originalPersonIdentwhen- local timetz- time zone
-
PersonIdent
Copy a PersonIdent, but alter the clone's time stamp- Parameters:
pi- originalPersonIdentwhen- local timetz- time zone offset- Since:
- 7.1
-
PersonIdent
Deprecated.Use the variant with an Instant insteadCopy aPersonIdent, but alter the clone's time stamp- Parameters:
pi- originalPersonIdentaWhen- local time
-
PersonIdent
Copy aPersonIdent, but alter the clone's time stamp- Parameters:
pi- originalPersonIdentaWhen- local time as Instant- Since:
- 6.1
-
PersonIdent
@Deprecated(since="7.1") public PersonIdent(String aName, String aEmailAddress, Date aWhen, TimeZone aTZ) Deprecated.Use the variant with Instant and ZoneId insteadConstruct a PersonIdent from simple data -
PersonIdent
Construct a PersonIdent from simple data -
PersonIdent
Deprecated.Use the variant with Instant and ZoneId insteadCopy a PersonIdent, but alter the clone's time stamp- Parameters:
pi- originalPersonIdentaWhen- local time stampaTZ- time zone
-
PersonIdent
@Deprecated(since="7.1") public PersonIdent(String aName, String aEmailAddress, long aWhen, int aTZ) Deprecated.Use the variant with Instant and ZoneId insteadConstruct 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
-
getZoneId
Translate a minutes offset into a ZoneId- Parameters:
tzOffset- as minutes east of UTC- Returns:
- a ZoneId for this offset
- Since:
- 7.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
Get name of person- Returns:
- Name of person
-
getEmailAddress
Get email address of person- Returns:
- email address of person
-
getWhen
Deprecated.Use getWhenAsInstant insteadGet timestamp- Returns:
- timestamp
-
getWhenAsInstant
Get when attribute as instant- Returns:
- timestamp
- Since:
- 6.1
-
getTimeZone
Deprecated.Use getZoneId insteadGet this person's declared time zone- Returns:
- this person's declared time zone; null if time zone is unknown.
-
getZoneId
Get the time zone id- Returns:
- the time zone id
- Since:
- 6.1
-
getZoneOffset
Return the offset in this timezone at the specific time- Returns:
- the offset
- Since:
- 7.1
-
getTimeZoneOffset
Deprecated.UsegetZoneOffset()and read minutes from thereGet 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
public int hashCode()Hashcode is based only on the email address and timestamp.
-
equals
-
toExternalString
Format for Git storage.- Returns:
- a string in the git author format
-
toString
-