org.wildfly.extension.fabric.parser.Namespace Maven / Gradle / Ivy
/*
* #%L
* Wildfly Gravia Subsystem
* %%
* Copyright (C) 2010 - 2013 JBoss by Red Hat
* %%
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation, either version 2.1 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Lesser Public License for more details.
*
* You should have received a copy of the GNU General Lesser Public
* License along with this program. If not, see
* .
* #L%
*/
package org.wildfly.extension.fabric.parser;
import java.util.EnumSet;
import java.util.HashMap;
import java.util.Map;
/**
* An enumeration of the supported Fabric subsystem namespaces.
*
* @since 13-Nov-2013
*/
enum Namespace {
// must be first
UNKNOWN(null),
VERSION_1_0("urn:jboss:domain:fabric:1.0")
;
/**
* The current namespace version.
*/
static final Namespace CURRENT = VERSION_1_0;
private final String name;
Namespace(final String name) {
this.name = name;
}
/**
* Get the URI of this namespace.
*/
String getUriString() {
return name;
}
/**
* Set of all namespaces, excluding the special {@link #UNKNOWN} value.
*/
static final EnumSet STANDARD_NAMESPACES = EnumSet.complementOf(EnumSet.of(Namespace.UNKNOWN));
private static final Map MAP;
static {
final Map map = new HashMap();
for (Namespace namespace : values()) {
final String name = namespace.getUriString();
if (name != null) map.put(name, namespace);
}
MAP = map;
}
static Namespace forUri(String uri) {
final Namespace element = MAP.get(uri);
return element == null ? UNKNOWN : element;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy