Class PrismNamespaceContext

    • Constructor Detail

      • PrismNamespaceContext

        public PrismNamespaceContext()
    • Method Detail

      • localPrefixes

        public abstract Map<String,​String> localPrefixes()
        Returns mapping of locally defined prefixes to namespaces Returns mapping of prefixes to namespaces defined in this namespace context. Note that mappings of parent namespaces context also apply, unless the prefix is overriden at current level.
        Returns:
        mapping of locally defined prefixes to namespaces
      • isInherited

        public abstract boolean isInherited()
        Returns true if context is only inherited and not explicitly defined.
        Returns:
        True if context is inherited, false if context is explicitly defined.
      • isLocalEmpty

        public abstract boolean isLocalEmpty()
        Return true, if context is empty on local level (no mappings defined, or context is inherited) Note: This is useful for context serialization - if context is empty, it should not be serialized
        Returns:
        True if context does not define local mappings.
      • isEmpty

        public abstract boolean isEmpty()
      • isDefaultNamespaceOnly

        public abstract boolean isDefaultNamespaceOnly()
      • namespaceFor

        public abstract Optional<String> namespaceFor​(String prefix)
        Returns namespace for specified prefix. If prefix is not defined at current context, parent contexts are lookup up for prefix.
        Returns:
        Empty, if no namespace was found, otherwise namespace assigned to supplied prefix.
      • prefixFor

        public final Optional<String> prefixFor​(String namespace)
        Look up suitable prefix for namespace using default prefix search preference-
        Parameters:
        namespace - Namespace for which prefix should be returned.
        Returns:
        Prefix which is mapped to namespace.
      • prefixFor

        public abstract Optional<String> prefixFor​(String namespace,
                                                   PrismNamespaceContext.PrefixPreference preference)
        Look up suitable prefix for namespace using provided preference.
        Parameters:
        namespace - Namespace for which prefix should be returned.
        preference - Preference (top-most or closest prefix) which should be returned.
        Returns:
        Prefix which is mapped to namespace.
      • childContext

        public abstract PrismNamespaceContext childContext​(Map<String,​String> local)
        Creates child namespace context with supplied local mapping
        Parameters:
        local - Local definition of prefixes
        Returns:
        Child context with local definitions
      • optimizedChildContext

        public abstract PrismNamespaceContext optimizedChildContext​(Map<String,​String> local)
        Creates optimized child namespace context with supplied local mapping
        Parameters:
        local - Local definition of prefixes
        Returns:
        Child context with local definitions
      • inherited

        public abstract PrismNamespaceContext inherited()
        Returns child namespace context with no local mappings. Implementation Note: Implementation ensures that instances of inherited context are reused (eg. context.inherited() == context.inherited() and context.inherited() == context.inherited().inherited() )
        Returns:
        child namespace context with no local mappings.