Class PrismNamespaceContext

java.lang.Object
com.evolveum.midpoint.prism.PrismNamespaceContext
All Implemented Interfaces:
Serializable

public abstract class PrismNamespaceContext extends Object implements Serializable
See Also:
  • Field Details

  • Constructor Details

    • PrismNamespaceContext

      public PrismNamespaceContext()
  • Method Details

    • from

      public static PrismNamespaceContext from(Map<String,String> prefixToNs)
    • builder

      public static PrismNamespaceContext.Builder builder()
    • parent

      public abstract Optional<PrismNamespaceContext> parent()
      Returns parent namespace context
      Returns:
      parent namespace context
    • 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 overridden at current level.
      Returns:
      mapping of locally defined prefixes to namespaces
    • allPrefixes

      public abstract Map<String,String> allPrefixes()
    • 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.
    • defaultNamespace

      public Optional<String> defaultNamespace()
    • 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.
    • of

      public static PrismNamespaceContext of(String ns)
    • childDefaultNamespace

      public PrismNamespaceContext childDefaultNamespace(String namespace)
    • rebasedOn

      public abstract PrismNamespaceContext rebasedOn(PrismNamespaceContext current)
    • withoutDefault

      @NotNull public @NotNull PrismNamespaceContext withoutDefault()
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • childBuilder

      public abstract PrismNamespaceContext.Builder childBuilder()