org.codehaus.enunciate
Class XmlQNameEnumUtil

java.lang.Object
  extended by org.codehaus.enunciate.XmlQNameEnumUtil

public class XmlQNameEnumUtil
extends java.lang.Object

Utilities for converting a QName to/from an QNameEnum. See QName Enums.

Author:
Ryan Heaton

Method Summary
static
<Q extends java.lang.Enum<Q>>
Q
fromQName(javax.xml.namespace.QName qname, java.lang.Class<Q> clazz)
          Convert a QName to a QName enum.
static
<Q extends java.lang.Enum<Q>>
Q
fromURI(java.net.URI uri, java.lang.Class<Q> clazz)
          Convert a URI to a QName enum.
static
<Q extends java.lang.Enum<Q>>
Q
fromURIValue(java.lang.String uriValue, java.lang.Class<Q> clazz)
          Convert a URI to a QName enum.
static javax.xml.namespace.QName toQName(java.lang.Enum e)
          Convert an enum to a QName.
static java.net.URI toURI(java.lang.Enum e)
          Convert an enum to a URI.
static java.lang.String toURIValue(java.lang.Enum e)
          Convert an enum to a URI.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

fromQName

public static <Q extends java.lang.Enum<Q>> Q fromQName(javax.xml.namespace.QName qname,
                                                        java.lang.Class<Q> clazz)
Convert a QName to a QName enum. See QName Enums.

Parameters:
qname - The qname to convert.
clazz - The enum clazz.
Returns:
The matching enum, or the unknown enum if unable to find an enum for the specified QName, or null if unable to find an enum for the specified QName and there is no unknown enum specified.
Throws:
java.lang.IllegalArgumentException - If clazz isn't a QName enum.

toQName

public static javax.xml.namespace.QName toQName(java.lang.Enum e)
Convert an enum to a QName. See QName Enums.

Parameters:
e - The enum.
Returns:
The QName.
Throws:
java.lang.IllegalArgumentException - If e isn't of a valid QName enum type, or if e is the unknown enum, or if the enum is excluded as an enum value.

fromURI

public static <Q extends java.lang.Enum<Q>> Q fromURI(java.net.URI uri,
                                                      java.lang.Class<Q> clazz)
Convert a URI to a QName enum. See QName Enums.

Parameters:
uri - The uri to convert.
clazz - The enum clazz.
Returns:
The matching enum, or the unknown enum if unable to find an enum for the specified URI, or null if unable to find an enum for the specified URI and there is no unknown enum specified.
Throws:
java.lang.IllegalArgumentException - If clazz isn't a QName enum.

fromURIValue

public static <Q extends java.lang.Enum<Q>> Q fromURIValue(java.lang.String uriValue,
                                                           java.lang.Class<Q> clazz)
Convert a URI to a QName enum. See QName Enums.

Parameters:
uriValue - The value of the uri to convert.
clazz - The enum clazz.
Returns:
The matching enum, or the unknown enum if unable to find an enum for the specified URI, or null if unable to find an enum for the specified URI and there is no unknown enum specified.
Throws:
java.lang.IllegalArgumentException - If clazz isn't a QName enum.

toURI

public static java.net.URI toURI(java.lang.Enum e)
Convert an enum to a URI. See QName Enums.

Parameters:
e - The enum.
Returns:
The URI.
Throws:
java.lang.IllegalArgumentException - If e isn't of a valid QName enum type, or if e is the unknown enum, or if the enum is excluded as an enum value.

toURIValue

public static java.lang.String toURIValue(java.lang.Enum e)
Convert an enum to a URI. See QName Enums.

Parameters:
e - The enum.
Returns:
The URI.
Throws:
java.lang.IllegalArgumentException - If e isn't of a valid QName enum type, or if e is the unknown enum, or if the enum is excluded as an enum value.