X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=src%2Fde%2Ftodesbaum%2Futil%2Ffreenet%2Ffcp2%2FPriorityClass.java;h=623bc5b1166511fdf5b591db14903e87f6ea6d80;hb=7d276e5fb9dcd62b6be651f572964788fac8131a;hp=d9af59716a06a4e79d498c1c76228df09c1d8077;hpb=e47e15fdbb7515f5a3757c3f5df8c1d0950aee8e;p=jSite.git diff --git a/src/de/todesbaum/util/freenet/fcp2/PriorityClass.java b/src/de/todesbaum/util/freenet/fcp2/PriorityClass.java index d9af597..623bc5b 100644 --- a/src/de/todesbaum/util/freenet/fcp2/PriorityClass.java +++ b/src/de/todesbaum/util/freenet/fcp2/PriorityClass.java @@ -89,4 +89,37 @@ public final class PriorityClass { return value; } + // + // STATIC METHODS + // + + /** + * Returns the priority class with the given name, matched case-insensitive. + * + * @param value + * The name of the priority + * @return The priority with the given name, or {@code null} if no priority + * matches the given name + */ + public static PriorityClass valueOf(String value) { + for (PriorityClass priorityClass : new PriorityClass[] { MINIMUM, PREFETCH, BULK, UPDATABLE, SEMI_INTERACTIVE, INTERACTIVE, MAXIMUM }) { + if (priorityClass.getName().equalsIgnoreCase(value)) { + return priorityClass; + } + } + return null; + } + + // + // OBJECT METHODS + // + + /** + * {@inheritDoc} + */ + @Override + public String toString() { + return name; + } + }