Package io.microsphere.lang
Interface Prioritized
-
- All Superinterfaces:
java.lang.Comparable<Prioritized>
- All Known Subinterfaces:
ArtifactResourceResolver,ConditionalEventListener<E>,ConfigurationPropertyGenerator,ConfigurationPropertyLoader,ConfigurationPropertyReader,Converter<S,T>,EventListener<E>,FileChangedListener,MultiValueConverter<S>,ProcessIdResolver,StringConverter<T>,StringToMultiValueConverter,URLClassPathHandle
- All Known Implementing Classes:
AbstractArtifactResourceResolver,AbstractConverter,AbstractURLClassPathHandle,ACLLoggerFactory,AdditionalMetadataResourceConfigurationPropertyLoader,ArchiveFileArtifactResourceResolver,ByteArrayToObjectConverter,ClassicProcessIdResolver,ClassicURLClassPathHandle,ClassPathResourceConfigurationPropertyLoader,DefaultConfigurationPropertyGenerator,DefaultConfigurationPropertyReader,GenericEventListener,JDKLoggerFactory,LoggerFactory,LoggingFileChangedListener,ManifestArtifactResourceResolver,MapToPropertiesConverter,MavenArtifactResourceResolver,MetadataResourceConfigurationPropertyLoader,ModernProcessIdResolver,ModernURLClassPathHandle,NoOpLoggerFactory,NoOpURLClassPathHandle,NumberToByteConverter,NumberToCharacterConverter,NumberToDoubleConverter,NumberToFloatConverter,NumberToIntegerConverter,NumberToLongConverter,NumberToShortConverter,ObjectToBooleanConverter,ObjectToByteArrayConverter,ObjectToByteConverter,ObjectToCharacterConverter,ObjectToDoubleConverter,ObjectToFloatConverter,ObjectToIntegerConverter,ObjectToLongConverter,ObjectToOptionalConverter,ObjectToShortConverter,ObjectToStringConverter,PropertiesToStringConverter,ReflectiveConfigurationPropertyGenerator,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>
Prioritizedinterface 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>COMPARATORTheComparatorofPrioritizedstatic intMAX_PRIORITYThe maximum prioritystatic intMIN_PRIORITYThe minimum prioritystatic intNORMAL_PRIORITYNormal Priority
-
Method Summary
All Methods Instance Methods Default Methods Modifier and Type Method Description default intcompareTo(Prioritized that)default intgetPriority()Get the priority
-
-
-
Field Detail
-
COMPARATOR
static final java.util.Comparator<java.lang.Object> COMPARATOR
TheComparatorofPrioritized
-
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:
compareToin interfacejava.lang.Comparable<Prioritized>
-
-