org.switchyard.component.camel.sql.model.CamelSqlNamespace Maven / Gradle / Ivy
/*
* Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.switchyard.component.camel.sql.model;
import org.switchyard.config.model.Descriptor;
import org.switchyard.config.model.Namespace;
/**
* A Camel Sql config model namespace.
*
* @author David Ward <[email protected]> © 2013 Red Hat Inc.
*/
public enum CamelSqlNamespace implements Namespace {
/** The 1.0 namespace. */
V_1_0("1.0"),
/** The 1.1 namespace. */
V_1_1("1.1"),
/** The 2.0 namespace. */
V_2_0("2.0"),
/** The default namespace. */
DEFAULT(null);
private final transient Util _util;
/**
* Constructs a new CamelSqlNamespace with the specified version.
* @param version the specified version, or null to discover the default
*/
CamelSqlNamespace(String version) {
_util = new Util(version);
}
/**
* {@inheritDoc}
*/
@Override
public String section() {
return _util.section();
}
/**
* {@inheritDoc}
*/
@Override
public String version() {
return _util.version();
}
/**
* {@inheritDoc}
*/
@Override
public boolean versionMatches(Namespace namespace) {
return _util.versionMatches(namespace);
}
/**
* {@inheritDoc}
*/
@Override
public String uri() {
return _util.uri();
}
/**
* {@inheritDoc}
*/
@Override
public boolean uriMatches(Namespace namespace) {
return _util.uriMatches(namespace);
}
/**
* {@inheritDoc}
*/
@Override
public boolean isDefault() {
return this == DEFAULT || uriMatches(DEFAULT);
}
/**
* Gets the CamelSqlNamespace for the specified uri, or null if no matching uris are found.
* @param uri the uri
* @return the CamelSqlNamespace
*/
public static CamelSqlNamespace fromUri(String uri) {
return Util.fromUri(CamelSqlNamespace.class, uri);
}
@SuppressWarnings("serial")
private static final class Util extends Namespace.Util {
// static final since we only want to do the somewhat expensive work of instantiating this once!
private static final Descriptor DESCRIPTOR = new Descriptor(CamelSqlNamespace.class);
private Util(String version) {
super(DESCRIPTOR, "urn:switchyard-component-camel-sql:config", version);
}
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy