public class QNameEnumUtil extends Object
Modifier and Type | Method and Description |
---|---|
static <Q extends Enum<Q>> |
fromQName(QName qname,
Class<Q> clazz)
Convert a QName to a QName enum.
|
static <Q extends Enum<Q>> |
fromURI(String uriValue,
Class<Q> clazz)
Convert a URI to a QName enum.
|
static <Q extends Enum<Q>> |
fromURI(String uriValue,
Class<Q> clazz,
String defaultBaseUri)
Convert a URI to a QName enum.
|
static String |
getDefaultBaseUri()
Get the default base uri for resolving qname URIs.
|
static boolean |
isWriteRelativeUris()
Whether to write URI enums using relative URIs.
|
static void |
setDefaultBaseUri(String uri)
Set the default base uri for resolving qname URIs.
|
static void |
setWriteRelativeUris(boolean writeRelativeUris)
Whether to write URI enums using relative URIs.
|
static QName |
toQName(Enum e)
Convert an enum to a QName.
|
static String |
toURI(Enum<?> e)
Convert an enum to a URI.
|
static String |
toURI(Enum<?> e,
String defaultBaseUri)
Convert an enum to a URI.
|
public static void setDefaultBaseUri(String uri)
uri
- The default base URI.public static String getDefaultBaseUri()
public static boolean isWriteRelativeUris()
public static void setWriteRelativeUris(boolean writeRelativeUris)
writeRelativeUris
- Whether to write URI enums using relative URIs.public static <Q extends Enum<Q>> Q fromQName(QName qname, Class<Q> clazz)
qname
- The qname to convert.clazz
- The enum clazz.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.IllegalArgumentException
- If clazz
isn't a QName enum.public static QName toQName(Enum e)
e
- The enum.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
.public static <Q extends Enum<Q>> Q fromURI(String uriValue, Class<Q> clazz)
uriValue
- The value of the uri to convert.clazz
- The enum clazz.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.IllegalArgumentException
- If clazz
isn't a QName enum.public static <Q extends Enum<Q>> Q fromURI(String uriValue, Class<Q> clazz, String defaultBaseUri)
uriValue
- The value of the uri to convert.clazz
- The enum clazz.defaultBaseUri
- The default base uri, used to resolve relative URI references (null is allowed).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.IllegalArgumentException
- If clazz
isn't a QName enum.public static String toURI(Enum<?> e)
e
- The enum.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
.public static String toURI(Enum<?> e, String defaultBaseUri)
e
- The enum.defaultBaseUri
- The default base uri, used to resolve relative URI references (null is allowed).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
.Copyright © 2006-2016–2018. All rights reserved.