public abstract class IdStrategy extends AbstractDescribableImpl<IdStrategy> implements ExtensionPoint, Comparator<String>
Modifier and Type | Class and Description |
---|---|
static class |
IdStrategy.CaseInsensitive
The default case insensitive
IdStrategy |
static class |
IdStrategy.CaseSensitive
A case sensitive
IdStrategy |
static class |
IdStrategy.CaseSensitiveEmailAddress
A case sensitive email address
IdStrategy . |
ExtensionPoint.LegacyInstancesAreScopedToHudson
Modifier and Type | Field and Description |
---|---|
static IdStrategy |
CASE_INSENSITIVE
The default case insensitive strategy.
|
Constructor and Description |
---|
IdStrategy() |
Modifier and Type | Method and Description |
---|---|
static DescriptorExtensionList<IdStrategy,IdStrategyDescriptor> |
all()
Returns all the registered
IdStrategy descriptors. |
abstract int |
compare(String id1,
String id2)
Compare two IDs and return their sorting order.
|
boolean |
equals(Object obj)
This method is used to decide whether a
User.rekey() operation is required. |
boolean |
equals(String id1,
String id2)
Compare two IDs and return
true IFF the two ids are the same. |
String |
filenameOf(String id)
Deprecated.
No current use.
|
IdStrategyDescriptor |
getDescriptor()
By default looks for a nested class (conventionally named
DescriptorImpl ) implementing Descriptor and marked with Extension . |
int |
hashCode() |
String |
idFromFilename(String filename)
Deprecated.
Use only for migrating to new format. After the migration an id is no longer represented by a filename (directory).
|
String |
keyFor(String id)
Converts an ID into a key for use in a Java Map or similar.
|
String |
legacyFilenameOf(String id)
Deprecated.
No current use.
|
String |
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
public static IdStrategy CASE_INSENSITIVE
@Deprecated public String filenameOf(@NonNull String id)
id
- the id.@Deprecated @Restricted(value=org.kohsuke.accmod.restrictions.ProtectedExternally.class) public String legacyFilenameOf(@NonNull String id)
id
- the id@Deprecated public String idFromFilename(@NonNull String filename)
filename
- the filename.@NonNull public String keyFor(@NonNull String id)
id
- the id.public boolean equals(@NonNull String id1, @NonNull String id2)
true
IFF the two ids are the same. Normally we expect that this should be
the same as 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.id1
- the first id.id2
- the second id.true
if and only if the two ids are the same.public abstract int compare(@NonNull String id1, @NonNull String id2)
equals(String, String)
is true
then this
must return 0
but compare(String, String)
returning 0
need not imply that
equals(String, String)
is true
.compare
in interface Comparator<String>
id1
- the first id.id2
- the second id.public IdStrategyDescriptor getDescriptor()
AbstractDescribableImpl
DescriptorImpl
) implementing Descriptor
and marked with Extension
.
Gets the descriptor for this instance.
Descriptor
is a singleton for every concrete Describable
implementation, so if a.getClass() == b.getClass()
then by default
a.getDescriptor() == b.getDescriptor()
as well.
(In rare cases a single implementation class may be used for instances with distinct descriptors.)
getDescriptor
in interface Describable<IdStrategy>
getDescriptor
in class AbstractDescribableImpl<IdStrategy>
public boolean equals(Object obj)
User.rekey()
operation is required.equals
in interface Comparator<String>
equals
in class Object
obj
- the object to compare with.true
if and only if this
is the same as obj
.public static DescriptorExtensionList<IdStrategy,IdStrategyDescriptor> all()
IdStrategy
descriptors.Copyright © 2004–2021. All rights reserved.