Package io.microsphere.lang
Interface Prioritized
-
- All Superinterfaces:
java.lang.Comparable<Prioritized>
- All Known Subinterfaces:
ArtifactResourceResolver
,ConditionalEventListener<E>
,Converter<S,T>
,EventListener<E>
,FileChangedListener
,MultiValueConverter<S>
,ProcessIdResolver
,StringConverter<T>
,StringToMultiValueConverter
,URLClassPathHandle
- All Known Implementing Classes:
AbstractArtifactResourceResolver
,AbstractConverter
,AbstractURLClassPathHandle
,ACLLoggerFactory
,ArchiveFileArtifactResourceResolver
,ByteArrayToObjectConverter
,ClassicProcessIdResolver
,ClassicURLClassPathHandle
,GenericEventListener
,JDKLoggerFactory
,LoggerFactory
,LoggingFileChangedListener
,ManifestArtifactResourceResolver
,MapToPropertiesConverter
,MavenArtifactResourceResolver
,ModernProcessIdResolver
,ModernURLClassPathHandle
,NoOpLoggerFactory
,NoOpURLClassPathHandle
,NumberToByteConverter
,NumberToCharacterConverter
,NumberToDoubleConverter
,NumberToFloatConverter
,NumberToIntegerConverter
,NumberToLongConverter
,NumberToShortConverter
,ObjectToBooleanConverter
,ObjectToByteArrayConverter
,ObjectToByteConverter
,ObjectToCharacterConverter
,ObjectToDoubleConverter
,ObjectToFloatConverter
,ObjectToIntegerConverter
,ObjectToLongConverter
,ObjectToOptionalConverter
,ObjectToShortConverter
,ObjectToStringConverter
,PropertiesToStringConverter
,ServiceLoadingURLClassPathHandle
,Sfl4jLoggerFactory
,StreamArtifactResourceResolver
,StringToArrayConverter
,StringToBlockingDequeConverter
,StringToBlockingQueueConverter
,StringToBooleanConverter
,StringToByteConverter
,StringToCharacterConverter
,StringToCharArrayConverter
,StringToClassConverter
,StringToCollectionConverter
,StringToDequeConverter
,StringToDoubleConverter
,StringToDurationConverter
,StringToFloatConverter
,StringToInputStreamConverter
,StringToIntegerConverter
,StringToIterableConverter
,StringToListConverter
,StringToLongConverter
,StringToNavigableSetConverter
,StringToQueueConverter
,StringToSetConverter
,StringToShortConverter
,StringToSortedSetConverter
,StringToStringConverter
,StringToTransferQueueConverter
,VirtualMachineProcessIdResolver
public interface Prioritized extends java.lang.Comparable<Prioritized>
Prioritized
interface can be implemented by objects that should be sorted, for example the tasks in executable queue.Implementing classes should typically also implement the
getPriority()
method to define their priority value. The priority is used to determine ordering via thecompareTo(Prioritized)
method, which compares based on the returned priority values.Example Usage
public class MyTask implements Prioritized { private final int priority; public MyTask(int priority) { this.priority = priority; } public int getPriority() { return priority; } } // Sorting a list of Prioritized objects List<Prioritized> tasks = new ArrayList<>(); tasks.add(new MyTask(5)); tasks.add(new MyTask(1)); Collections.sort(tasks);
- Since:
- 1.0.0
-
-
Field Summary
Fields Modifier and Type Field Description static java.util.Comparator<java.lang.Object>
COMPARATOR
TheComparator
ofPrioritized
static int
MAX_PRIORITY
The maximum prioritystatic int
MIN_PRIORITY
The minimum prioritystatic int
NORMAL_PRIORITY
Normal Priority
-
Method Summary
All Methods Instance Methods Default Methods Modifier and Type Method Description default int
compareTo(Prioritized that)
default int
getPriority()
Get the priority
-
-
-
Field Detail
-
COMPARATOR
static final java.util.Comparator<java.lang.Object> COMPARATOR
TheComparator
ofPrioritized
-
MAX_PRIORITY
static final int MAX_PRIORITY
The maximum priority- See Also:
- Constant Field Values
-
MIN_PRIORITY
static final int MIN_PRIORITY
The minimum priority- See Also:
- Constant Field Values
-
NORMAL_PRIORITY
static final int NORMAL_PRIORITY
Normal Priority- See Also:
- Constant Field Values
-
-
Method Detail
-
getPriority
default int getPriority()
Get the priority- Returns:
- the default is
minimum one
-
compareTo
default int compareTo(Prioritized that)
- Specified by:
compareTo
in interfacejava.lang.Comparable<Prioritized>
-
-