public static class IdStrategy.CaseSensitiveEmailAddress extends IdStrategy.CaseSensitive implements Serializable
IdStrategy
. Providing this implementation among the set of default
implementations as given the history of misunderstanding in the Jenkins code base around ID case sensitivity,
if not provided people will get this wrong.
Note: Not all email addresses are case sensitive. It is knowledge that belongs to the server that holds the mailbox. Most sane system administrators do not configure their accounts using case sensitive mailboxes but the RFC does allow them the option to configure that way. Domain names are always case insensitive per RFC.
Modifier and Type | Class and Description |
---|---|
static class |
IdStrategy.CaseSensitiveEmailAddress.DescriptorImpl |
IdStrategy.CaseInsensitive, IdStrategy.CaseSensitive, IdStrategy.CaseSensitiveEmailAddress
ExtensionPoint.LegacyInstancesAreScopedToHudson
CASE_INSENSITIVE
Constructor and Description |
---|
CaseSensitiveEmailAddress() |
Modifier and Type | Method and Description |
---|---|
int |
compare(String id1,
String id2)
Compare two IDs and return their sorting order.
|
boolean |
equals(String id1,
String id2)
Compare two IDs and return
true IFF the two ids are the same. |
String |
keyFor(String id)
Converts an ID into a key for use in a Java Map or similar.
|
idFromFilename
all, equals, filenameOf, getDescriptor, hashCode, legacyFilenameOf, toString
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
comparing, comparing, comparingDouble, comparingInt, comparingLong, naturalOrder, nullsFirst, nullsLast, reversed, reverseOrder, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLong
@DataBoundConstructor public CaseSensitiveEmailAddress()
public boolean equals(@NonNull String id1, @NonNull String id2)
IdStrategy
true
IFF the two ids are the same. Normally we expect that this should be
the same as IdStrategy.compare(String, String)
being equal to 0
, however there may be a specific reason
for going beyond that, such as sorting id's case insensitively while treating them as case sensitive.
Subclasses may want to override this naïve implementation that calls compare(id1, id2) == 0
for a more performant implementation.equals
in class IdStrategy.CaseSensitive
id1
- the first id.id2
- the second id.true
if and only if the two ids are the same.@NonNull public String keyFor(@NonNull String id)
IdStrategy
keyFor
in class IdStrategy
id
- the id.public int compare(@NonNull String id1, @NonNull String id2)
IdStrategy
IdStrategy.equals(String, String)
is true
then this
must return 0
but IdStrategy.compare(String, String)
returning 0
need not imply that
IdStrategy.equals(String, String)
is true
.compare
in interface Comparator<String>
compare
in class IdStrategy.CaseSensitive
id1
- the first id.id2
- the second id.Copyright © 2004–2021. All rights reserved.