add byKey method to CondensedDistributionRecipe
authorAndreas Müller <a.mueller@bgbm.org>
Mon, 10 May 2021 08:24:37 +0000 (10:24 +0200)
committerAndreas Müller <a.mueller@bgbm.org>
Mon, 10 May 2021 08:28:26 +0000 (10:28 +0200)
cdmlib-ext/src/main/java/eu/etaxonomy/cdm/ext/geo/CondensedDistributionRecipe.java

index ee311da1edf59893b5cec21d7821debef8a2f9f6..8a6b4007f0daee76134243dfc849763fb7cbf267 100644 (file)
@@ -57,4 +57,17 @@ public enum CondensedDistributionRecipe implements IKeyLabel{
             return CondensedDistributionConfiguration.NewDefaultInstance();
         }
     }
+
+    public CondensedDistributionRecipe byKey(String key) {
+        if (key == null){
+            return null;
+        }else{
+            for (CondensedDistributionRecipe rec: values()){
+                if (rec.getKey().equalsIgnoreCase(key)){
+                    return rec;
+                }
+            }
+        }
+        return null;
+    }
 }