Stuart McCulloch | 26e7a5a | 2011-10-17 10:31:43 +0000 | [diff] [blame^] | 1 | package aQute.lib.deployer.obr; |
| 2 | |
| 3 | public enum CapabilityType { |
| 4 | |
| 5 | PACKAGE("package"), |
| 6 | EE("ee"), |
| 7 | BUNDLE("bundle"), |
| 8 | MODE("mode"), |
| 9 | OTHER(null); |
| 10 | |
| 11 | private String typeName; |
| 12 | |
| 13 | CapabilityType(String name) { |
| 14 | this.typeName = name; |
| 15 | } |
| 16 | |
| 17 | public String getTypeName() { |
| 18 | return typeName; |
| 19 | } |
| 20 | |
| 21 | /** |
| 22 | * @throws IllegalArgumentException |
| 23 | */ |
| 24 | public static CapabilityType getForTypeName(String typeName) { |
| 25 | for (CapabilityType type : CapabilityType.values()) { |
| 26 | if (type.typeName != null && type.typeName.equals(typeName)) |
| 27 | return type; |
| 28 | } |
| 29 | throw new IllegalArgumentException("Unknown capability type: " + typeName); |
| 30 | } |
| 31 | } |