X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=src%2Fde%2Ftodesbaum%2Futil%2Ffreenet%2Ffcp2%2FPriorityClass.java;h=729acc175a1c73539a6f39e73f7b1c75695ac16a;hb=53c860450fde63ab927a457611e49e94ce2649db;hp=d9af59716a06a4e79d498c1c76228df09c1d8077;hpb=7190b9b0ac46b632ceac415fcff5c3e1507905d9;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..729acc1 100644 --- a/src/de/todesbaum/util/freenet/fcp2/PriorityClass.java +++ b/src/de/todesbaum/util/freenet/fcp2/PriorityClass.java @@ -89,4 +89,25 @@ 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; + } + }