Package org.pgpainless.key.util
Class UserId
java.lang.Object
org.pgpainless.key.util.UserId
- All Implemented Interfaces:
CharSequence
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final class
static class
static class
-
Method Summary
Modifier and TypeMethodDescriptionasString()
Deprecated.char
charAt
(int i) static int
compare
(UserId o1, UserId o2, Comparator<UserId> comparator) boolean
getEmail()
getName()
getName
(boolean preserveQuotes) int
hashCode()
int
length()
static UserId
nameAndEmail
(String name, String email) static UserId.Builder
static UserId
static UserId
Parse aUserId
from free-form text,subSequence
(int i, int i1) toString()
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.lang.CharSequence
chars, codePoints, isEmpty
-
Method Details
-
parse
Parse aUserId
from free-form text,name-addr
ormailbox
string and split it up into its components. Example inputs for this method:john@pgpainless.org
<john@pgpainless.org>
John Doe
John Doe <john@pgpainless.org>
John Doe (work email) <john@pgpainless.org>
- Local domains without TLDs (
user@localdomain1
) " "@example.org
(spaces between the quotes)"very.(),:;<>[]\".VERY.\"very@\\ \"very\".unusual"@strange.example.com
string.equals(UserId.parse(string).toString())
is true. For example,UserId.parse("alice@pgpainless.org").toString()
wraps the mail address in angled brackets.- Parameters:
string
- user-id- Returns:
- parsed
UserId
object - See Also:
-
onlyEmail
-
nameAndEmail
-
newBuilder
-
toBuilder
-
getName
-
getName
-
getComment
-
getEmail
-
length
public int length()- Specified by:
length
in interfaceCharSequence
-
charAt
public char charAt(int i) - Specified by:
charAt
in interfaceCharSequence
-
subSequence
- Specified by:
subSequence
in interfaceCharSequence
-
toString
- Specified by:
toString
in interfaceCharSequence
- Overrides:
toString
in classObject
-
asString
Deprecated.usetoString()
instead.Returns a string representation of the object.- Returns:
- a string representation of the object.
-
equals
-
hashCode
public int hashCode() -
compare
public static int compare(@Nullable UserId o1, @Nullable UserId o2, @Nonnull Comparator<UserId> comparator)
-
toString()
instead.