|
xmlBlaster 2.2.0 API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.xmlBlaster.util.def.PriorityEnum
public final class PriorityEnum
This class simulates an enumeration for queue priorities, it ensures that only valid priorities are used.
Note that this implementation has a fixed number of priorities, namely from 0 (lowest) to 9 (highest). For performance reasons we have not used an interface in the queue implementation to hide this priority implementation (calling a method through an interface takes 20 CPU cycles instead of 2).
If you need a different set of priorities, replace this implementation or change it to support an adjustable amount of priorities.
Nested Class Summary | |
---|---|
private static class |
PriorityEnum.SerializedForm
|
Field Summary | |
---|---|
static PriorityEnum |
HIGH_PRIORITY
The higher priority of a message (7 or HIGH). |
static PriorityEnum |
HIGH8_PRIORITY
The higher priority of a message (8). |
private static java.lang.Integer[] |
integerArr
Create Integer instances for each priority, for performance reasons only. |
static PriorityEnum |
LOW_PRIORITY
The lower priority of a message (3 or LOW). |
static PriorityEnum |
LOW4_PRIORITY
The lower priority of a message (4). |
static PriorityEnum |
MAX_PRIORITY
The maximum priority of a message (9 or MAX). |
static PriorityEnum |
MIN_PRIORITY
The minimum priority of a message (0 or MIN). |
static PriorityEnum |
MIN1_PRIORITY
The minimum priority of a message (1). |
static PriorityEnum |
MIN2_PRIORITY
The minimum priority of a message (2). |
static PriorityEnum |
NORM_PRIORITY
The default priority of a message (5 or NORM). |
static PriorityEnum |
NORM6_PRIORITY
The default priority of a message (6). |
private int |
priority
|
private static PriorityEnum[] |
priorityEnumArr
For good performance have a static array of all priorities |
private static long |
serialVersionUID
|
Constructor Summary | |
---|---|
private |
PriorityEnum()
|
private |
PriorityEnum(int priority)
|
Method Summary | |
---|---|
int |
getInt()
Returns the int representation of this priority |
java.lang.Integer |
getInteger()
Returns the Integer representation of this priority |
static void |
main(java.lang.String[] args)
java org.xmlBlaster.util.def.PriorityEnum |
static PriorityEnum |
parsePriority(java.lang.String prio)
Parses given string to extract the priority of a message |
static PriorityEnum |
parsePriority(java.lang.String priority,
PriorityEnum defaultPriority)
Parses given string to extract the priority of a message |
static PriorityEnum |
toPriorityEnum(int priority)
Checks the given int and returns the corresponding PriorityEnum instance. |
java.lang.String |
toString()
Return a human readable string of the priority |
java.lang.Object |
writeReplace()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
private static final long serialVersionUID
private final int priority
public static final PriorityEnum MIN_PRIORITY
public static final PriorityEnum MIN1_PRIORITY
public static final PriorityEnum MIN2_PRIORITY
public static final PriorityEnum LOW_PRIORITY
public static final PriorityEnum LOW4_PRIORITY
public static final PriorityEnum NORM_PRIORITY
public static final PriorityEnum NORM6_PRIORITY
public static final PriorityEnum HIGH_PRIORITY
public static final PriorityEnum HIGH8_PRIORITY
public static final PriorityEnum MAX_PRIORITY
private static final PriorityEnum[] priorityEnumArr
private static final java.lang.Integer[] integerArr
Constructor Detail |
---|
private PriorityEnum(int priority)
private PriorityEnum()
Method Detail |
---|
public java.lang.String toString()
toString
in class java.lang.Object
public final int getInt()
public final java.lang.Integer getInteger()
public static final PriorityEnum toPriorityEnum(int priority) throws java.lang.IllegalArgumentException
prio
- For example 7
java.lang.IllegalArgumentException
- if the given priority is invalidpublic static final PriorityEnum parsePriority(java.lang.String prio) throws java.lang.IllegalArgumentException
prio
- For example "HIGH" or 7
java.lang.IllegalArgumentException
- if the given priority is invalidpublic static final PriorityEnum parsePriority(java.lang.String priority, PriorityEnum defaultPriority)
prio
- For example "HIGH" or 7defaultPriority
- Value to use if not parsable
public java.lang.Object writeReplace() throws java.io.ObjectStreamException
java.io.ObjectStreamException
public static void main(java.lang.String[] args)
|
xmlBlaster 2.2.0 API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |