/
Namespace.java
47 lines (39 loc) · 1.18 KB
/
Namespace.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
/*
* Copyright The JBoss Metadata Authors
* SPDX-License-Identifier: Apache-2.0
*/
package org.jboss.metadata.ejb.parser.jboss.ejb3;
import java.util.HashMap;
import java.util.Map;
/**
* @author <a href="mailto:cdewolf@redhat.com">Carlo de Wolf</a>
*/
public enum Namespace {
// must be first
UNKNOWN(null),
JBOSS("http://www.jboss.com/xml/ns/javaee"),
JBOSS_JAKARTA("urn:jboss:jakartaee:1.0"),
SPEC("http://java.sun.com/xml/ns/javaee"),
SPEC_7_0("http://xmlns.jcp.org/xml/ns/javaee"),
JAKARTAEE("https://jakarta.ee/xml/ns/jakartaee");
private final String uri;
Namespace(String uri) {
this.uri = uri;
}
public String getUriString() {
return uri;
}
private static final Map<String, Namespace> MAP;
static {
final Map<String, Namespace> map = new HashMap<>();
for (Namespace namespace : values()) {
final String name = namespace.getUriString();
if (name != null) map.put(name, namespace);
}
MAP = map;
}
public static Namespace forUri(String uri) {
final Namespace element = MAP.get(uri);
return element == null ? UNKNOWN : element;
}
}