Package com.evolveum.midpoint.util
Class QNameUtil
- java.lang.Object
-
- com.evolveum.midpoint.util.QNameUtil
-
public class QNameUtil extends Object
QName <-> URI conversion.Very simplistic but better than nothing.
- Author:
- semancik
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
QNameUtil.QNameInfo
-
Field Summary
Fields Modifier and Type Field Description static char
DEFAULT_QNAME_URI_SEPARATOR_CHAR
static Trace
LOGGER
-
Constructor Summary
Constructors Constructor Description QNameUtil()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static boolean
compareQName(QName qname, Node node)
static boolean
contains(Collection<? extends QName> col, QName qname)
static boolean
contains(QName[] array, QName qname)
static Collection<QName>
createCollection(QName... qnames)
static String
escapeElementName(String name)
static <V> V
getByQName(@NotNull Map<QName,V> map, @NotNull QName key)
Finds value in the map by QName key usingmatch(QName, QName)
.static String
getLocalPart(QName name)
static QName
getNodeQName(Node node)
static boolean
hasNamespace(@NotNull QName name)
static boolean
isPrefixUndeclared(String namespacePrefix)
static boolean
isQualified(QName name)
static boolean
isTolerateUndeclaredPrefixes()
static boolean
isUnqualified(String uri)
static boolean
isUnqualified(QName name)
static boolean
isUri(String string)
static String
markPrefixAsUndeclared(String namespacePrefix)
static boolean
match(QName a, QName b)
Matching with considering wildcard namespace (null).static boolean
match(QName a, QName b, boolean caseInsensitive)
static boolean
matchAny(QName nameToFind, Collection<? extends QName> names)
static boolean
matchUri(String uri1, String uri2)
static boolean
matchWithUri(QName qname, String uri)
Matches QName with a URI representation.static boolean
noNamespace(@NotNull QName name)
static QName
nullNamespace(QName qname)
static String
prettyPrint(QName... qnames)
static String
qNameToUri(QName qname)
static String
qNameToUri(QName qname, boolean unqualifiedStartsWithHash)
static String
qNameToUri(QName qname, boolean unqualifiedStartsWithHash, char separatorChar)
static QName
qualifyIfNeeded(QName name, String defaultNamespace)
static boolean
remove(Collection<? extends QName> col, QName qname)
static void
reportUndeclaredNamespacePrefix(String prefix, String context)
static QName
resolveNs(QName a, Collection<QName> col)
static void
setTemporarilyTolerateUndeclaredPrefixes(Boolean value)
static void
setTolerateUndeclaredPrefixes(boolean value)
static boolean
unorderedCollectionMatch(Collection<QName> a, Collection<QName> b)
static QName
unqualify(QName name)
static @NotNull QName
uriToQName(@NotNull String uri, boolean allowUnqualified)
static QName
uriToQName(String uri)
static @NotNull QName
uriToQName(String uri, String defaultNamespace)
static @NotNull QNameUtil.QNameInfo
uriToQNameInfo(@NotNull String uri, boolean allowUnqualified)
-
-
-
Field Detail
-
LOGGER
public static final Trace LOGGER
-
DEFAULT_QNAME_URI_SEPARATOR_CHAR
public static final char DEFAULT_QNAME_URI_SEPARATOR_CHAR
- See Also:
- Constant Field Values
-
-
Method Detail
-
qNameToUri
public static String qNameToUri(QName qname, boolean unqualifiedStartsWithHash, char separatorChar)
-
noNamespace
public static boolean noNamespace(@NotNull @NotNull QName name)
-
hasNamespace
public static boolean hasNamespace(@NotNull @NotNull QName name)
-
getByQName
public static <V> V getByQName(@NotNull @NotNull Map<QName,V> map, @NotNull @NotNull QName key)
Finds value in the map by QName key usingmatch(QName, QName)
. Fails if multiple matches are found. Returnsnull
if no match is found.
-
uriToQName
@NotNull public static @NotNull QName uriToQName(@NotNull @NotNull String uri, boolean allowUnqualified)
-
uriToQNameInfo
@NotNull public static @NotNull QNameUtil.QNameInfo uriToQNameInfo(@NotNull @NotNull String uri, boolean allowUnqualified)
-
match
public static boolean match(QName a, QName b)
Matching with considering wildcard namespace (null).
-
unorderedCollectionMatch
public static boolean unorderedCollectionMatch(Collection<QName> a, Collection<QName> b)
-
matchWithUri
public static boolean matchWithUri(QName qname, String uri)
Matches QName with a URI representation. The URL may in fact be just the local part.
-
resolveNs
public static QName resolveNs(QName a, Collection<QName> col)
-
matchAny
public static boolean matchAny(QName nameToFind, Collection<? extends QName> names)
-
createCollection
public static Collection<QName> createCollection(QName... qnames)
-
isUnqualified
public static boolean isUnqualified(QName name)
-
isQualified
public static boolean isQualified(QName name)
-
isUnqualified
public static boolean isUnqualified(String uri)
-
isTolerateUndeclaredPrefixes
public static boolean isTolerateUndeclaredPrefixes()
-
setTolerateUndeclaredPrefixes
public static void setTolerateUndeclaredPrefixes(boolean value)
-
setTemporarilyTolerateUndeclaredPrefixes
public static void setTemporarilyTolerateUndeclaredPrefixes(Boolean value)
-
reportUndeclaredNamespacePrefix
public static void reportUndeclaredNamespacePrefix(String prefix, String context)
-
isPrefixUndeclared
public static boolean isPrefixUndeclared(String namespacePrefix)
-
isUri
public static boolean isUri(String string)
-
contains
public static boolean contains(Collection<? extends QName> col, QName qname)
-
remove
public static boolean remove(Collection<? extends QName> col, QName qname)
-
-