Class GlobalDynamicNamespacePrefixMapper
- java.lang.Object
-
- com.sun.xml.bind.marshaller.NamespacePrefixMapper
-
- com.evolveum.midpoint.prism.impl.xml.GlobalDynamicNamespacePrefixMapper
-
- All Implemented Interfaces:
DynamicNamespacePrefixMapper
,DebugDumpable
public class GlobalDynamicNamespacePrefixMapper extends com.sun.xml.bind.marshaller.NamespacePrefixMapper implements DynamicNamespacePrefixMapper, DebugDumpable
Maps namespaces to preferred prefixes. Should be used through the code to avoid generation of prefixes. Although this is usually used as singleton (static), it can also be instantiated to locally override some namespace mappings. This is useful for prefixes like "tns" (schema) or "ri" (resource schema).- Author:
- Igor Farinic, Radovan Semancik
- See Also:
- MID-349
-
-
Field Summary
-
Fields inherited from interface com.evolveum.midpoint.util.DebugDumpable
INDENT_STRING
-
-
Constructor Summary
Constructors Constructor Description GlobalDynamicNamespacePrefixMapper()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addDeclaredByDefault(String prefix)
GlobalDynamicNamespacePrefixMapper
clone()
String
debugDump(int indent)
String
getDefaultNamespace()
Map<String,String>
getNamespacesDeclaredByDefault()
static String
getPreferredPrefix(String namespace)
String
getPreferredPrefix(String namespaceUri, String suggestion, boolean requirePrefix)
String
getPrefix(String namespace)
void
registerPrefix(String namespace, String prefix, boolean isDefaultNamespace)
void
registerPrefixLocal(String namespace, String prefix)
void
setDefaultNamespace(String defaultNamespace)
QName
setQNamePrefix(QName qname)
QName
setQNamePrefixExplicit(QName qname)
Makes sure that there is explicit prefix and not a default namespace prefix.-
Methods inherited from class com.sun.xml.bind.marshaller.NamespacePrefixMapper
getContextualNamespaceDecls, getPreDeclaredNamespaceUris, getPreDeclaredNamespaceUris2
-
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.evolveum.midpoint.util.DebugDumpable
debugDump, debugDumpLazily, debugDumpLazily
-
-
-
-
Method Detail
-
getDefaultNamespace
public String getDefaultNamespace()
-
setDefaultNamespace
public void setDefaultNamespace(String defaultNamespace)
-
addDeclaredByDefault
public void addDeclaredByDefault(String prefix)
- Specified by:
addDeclaredByDefault
in interfaceDynamicNamespacePrefixMapper
-
getNamespacesDeclaredByDefault
public Map<String,String> getNamespacesDeclaredByDefault()
- Specified by:
getNamespacesDeclaredByDefault
in interfaceDynamicNamespacePrefixMapper
-
registerPrefix
public void registerPrefix(String namespace, String prefix, boolean isDefaultNamespace)
- Specified by:
registerPrefix
in interfaceDynamicNamespacePrefixMapper
-
registerPrefixLocal
public void registerPrefixLocal(String namespace, String prefix)
- Specified by:
registerPrefixLocal
in interfaceDynamicNamespacePrefixMapper
-
getPrefix
public String getPrefix(String namespace)
- Specified by:
getPrefix
in interfaceDynamicNamespacePrefixMapper
-
setQNamePrefix
public QName setQNamePrefix(QName qname)
- Specified by:
setQNamePrefix
in interfaceDynamicNamespacePrefixMapper
-
setQNamePrefixExplicit
public QName setQNamePrefixExplicit(QName qname)
Description copied from interface:DynamicNamespacePrefixMapper
Makes sure that there is explicit prefix and not a default namespace prefix.- Specified by:
setQNamePrefixExplicit
in interfaceDynamicNamespacePrefixMapper
-
getPreferredPrefix
public String getPreferredPrefix(String namespaceUri, String suggestion, boolean requirePrefix)
- Specified by:
getPreferredPrefix
in classcom.sun.xml.bind.marshaller.NamespacePrefixMapper
-
getPreferredPrefix
public static String getPreferredPrefix(String namespace)
- Returns:
- preferred prefix for the namespace, if no prefix is assigned yet, then it will assign a prefix and return it.
-
clone
public GlobalDynamicNamespacePrefixMapper clone()
- Specified by:
clone
in interfaceDynamicNamespacePrefixMapper
- Overrides:
clone
in classObject
-
debugDump
public String debugDump(int indent)
- Specified by:
debugDump
in interfaceDebugDumpable
-
-