Package org.eclipse.jgit.transport
Class PushCertificateIdent
java.lang.Object
org.eclipse.jgit.transport.PushCertificateIdent
Identity in a push certificate.
This is similar to a PersonIdent
in that it
contains a name, timestamp, and timezone offset, but differs in the following
ways:
- It is always parsed from a UTF-8 string, rather than a raw commit buffer.
- It is not guaranteed to contain a name and email portion, since any UTF-8
string is a valid OpenPGP User ID (RFC4880 5.1.1). The raw User ID is always
available as
getUserId()
, butgetEmailAddress()
may return null. - The raw text from which the identity was parsed is available with
getRaw()
. This is necessary for losslessly reconstructing the signed push certificate payload.
- Since:
- 4.1
-
Field Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionPushCertificateIdent
(String userId, long when, int tzOffset) Construct a new identity from an OpenPGP User ID.private
PushCertificateIdent
(String raw, String userId, long when, int tzOffset) -
Method Summary
Modifier and TypeMethodDescriptionboolean
Get the email portion of the User IDgetName()
Get the name portion of the User ID.getRaw()
Get the raw string from which this identity was parsed.Get this person's declared time zoneint
Get this person's declared time zone as minutes east of UTC.Get the OpenPGP User ID, which may be any string.getWhen()
Get the timestamp of the identity.int
hashCode()
static PushCertificateIdent
Parse an identity from a string.toString()
-
Field Details
-
raw
-
userId
-
when
private final long when -
tzOffset
private final int tzOffset
-
-
Constructor Details
-
PushCertificateIdent
Construct a new identity from an OpenPGP User ID.- Parameters:
userId
- OpenPGP User ID; any UTF-8 string.when
- local time.tzOffset
- timezone offset; seegetTimeZoneOffset()
.
-
PushCertificateIdent
-
-
Method Details
-
parse
Parse an identity from a string.Spaces are trimmed when parsing the timestamp and timezone offset, with one exception. The timestamp must be preceded by a single space, and the rest of the string prior to that space (including any additional whitespace) is treated as the OpenPGP User ID.
If either the timestamp or timezone offsets are missing, mimics
RawParseUtils.parsePersonIdent(String)
behavior and sets them both to zero.- Parameters:
str
- string to parse.- Returns:
- a
PushCertificateIdent
object.
-
getRaw
Get the raw string from which this identity was parsed.If the string was constructed manually, a suitable canonical string is returned.
For the purposes of bytewise comparisons with other OpenPGP IDs, the string must be encoded as UTF-8.
- Returns:
- the raw string.
-
getUserId
Get the OpenPGP User ID, which may be any string.- Returns:
- the OpenPGP User ID, which may be any string.
-
getName
Get the name portion of the User ID.- Returns:
- the name portion of the User ID. If no email address would be
parsed by
getEmailAddress()
, returns the full User ID with spaces trimmed.
-
getEmailAddress
Get the email portion of the User ID- Returns:
- the email portion of the User ID, if one was successfully parsed
from
getUserId()
, or null.
-
getWhen
Get the timestamp of the identity.- Returns:
- the timestamp of the identity.
-
getTimeZone
Get this person's declared time zone- Returns:
- this person's declared time zone; null if the timezone 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.
-
equals
-
hashCode
public int hashCode() -
toString
-