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()
Show the content of the object intended for diagnostics by system administrator.String
debugDump(int indent)
String
getDefaultNamespace()
Map<String,String>
getNamespacesDeclaredByDefault()
static String
getPreferredPrefix(String namespace)
static String
getPreferredPrefix(String namespace, String hintPrefix)
String
getPreferredPrefix(String namespaceUri, String suggestion, boolean requirePrefix)
String
getPrefix(String namespace)
String
getPrefixExplicit(String namespace)
boolean
isAlwaysExplicit()
void
registerPrefix(String namespace, String prefix, boolean isDefaultNamespace)
void
registerPrefixLocal(String namespace, String prefix)
void
setAlwaysExplicit(boolean alwaysExplicit)
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
debugDumpLazily, debugDumpLazily
-
-
-
-
Method Detail
-
getDefaultNamespace
public String getDefaultNamespace()
-
setDefaultNamespace
public void setDefaultNamespace(String defaultNamespace)
-
isAlwaysExplicit
public boolean isAlwaysExplicit()
- Specified by:
isAlwaysExplicit
in interfaceDynamicNamespacePrefixMapper
-
setAlwaysExplicit
public void setAlwaysExplicit(boolean alwaysExplicit)
- Specified by:
setAlwaysExplicit
in interfaceDynamicNamespacePrefixMapper
-
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)
- Parameters:
namespace
-- Returns:
- preferred prefix for the namespace, if no prefix is assigned yet, then it will assign a prefix and return it.
-
getPreferredPrefix
public static String getPreferredPrefix(String namespace, String hintPrefix)
- Parameters:
namespace
-hintPrefix
-- Returns:
- preferred prefix for the namespace, if no prefix is assigned yet, then it assign hint prefix (if it is not assigned yet) or assign a new prefix and return it (if hint prefix is already assigned to other namespace).
-
clone
public GlobalDynamicNamespacePrefixMapper clone()
- Specified by:
clone
in interfaceDynamicNamespacePrefixMapper
- Overrides:
clone
in classObject
-
debugDump
public String debugDump()
Description copied from interface:DebugDumpable
Show the content of the object intended for diagnostics by system administrator. The out put should be suitable to use in system logs at "debug" level. It may be multi-line, but in that case it should be well indented and quite terse. As it is intended to be used by system administrator, it should not use any developer terms such as class names, exceptions or stack traces.- Specified by:
debugDump
in interfaceDebugDumpable
- Returns:
- content of the object intended for diagnostics by system administrator.
-
debugDump
public String debugDump(int indent)
- Specified by:
debugDump
in interfaceDebugDumpable
-
-