Interface IEnhancedQName

All Superinterfaces:
Comparable<IEnhancedQName>

public interface IEnhancedQName extends Comparable<IEnhancedQName>
An efficient cache-backed representation of a qualified name.

This implementation uses an underlying integer-based cache to reduce the memory footprint of qualified names and namespaces by reusing instances with the same namespace and local name.

  • Method Details

    • getIndexPosition

      int getIndexPosition()
      Get the index position of the qualified name.

      This value can be used in place of this object. The object can be retrieved using this index with the of(int) method.

      Returns:
      the index position
    • getNamespace

      @NonNull String getNamespace()
      Get the namespace part of the qualified name.
      Returns:
      the namespace
    • getNamespaceAsUri

      @NonNull URI getNamespaceAsUri()
      Get the namespace part of the qualified name.
      Returns:
      the namespace as a URI
    • getLocalName

      @NonNull String getLocalName()
      Get the local part of the qualified name.
      Returns:
      the local name
    • of

      @NonNull static Optional<IEnhancedQName> of(int index)
      Get an existing qualified name by looking up the cached entry using the provided index value.
      Parameters:
      index - the index value to lookup
      Returns:
      an optional containing the qualified name, if it exists
    • of

      @NonNull static IEnhancedQName of(@NonNull QName qname)
      Get a qualified name using the provided QName value.
      Parameters:
      qname - the qualified name to get
      Returns:
      the qualified name
    • of

      @NonNull static IEnhancedQName of(@NonNull String localName)
      Get a qualified name using the provided local name value with no namespace.
      Parameters:
      localName - the qualified name local part
      Returns:
      the qualified name
    • of

      @NonNull static IEnhancedQName of(@NonNull URI namespace, @NonNull String localName)
      Get a qualified name using the provided namespace and local name.
      Parameters:
      namespace - the qualified name namespace part
      localName - the qualified name local part
      Returns:
      the qualified name
    • of

      @NonNull static IEnhancedQName of(@NonNull String namespace, @NonNull String localName)
      Get a qualified name using the provided namespace and local name.
      Parameters:
      namespace - the qualified name namespace part
      localName - the qualified name local part
      Returns:
      the qualified name
    • toEQName

      @NonNull default String toEQName()
      Generate a qualified name for this QName.

      This method uses prefixes associated with well-known namespaces, or will prepend the namespace if no prefix can be resolved.

      Returns:
      the extended qualified-name
    • toEQName

      @NonNull default String toEQName(@Nullable IEnhancedQName.NamespaceToPrefixResolver resolver)
      Generate a qualified name for this QName, use a prefix provided by the resolver, or by prepending the namespace if no prefix can be resolved.
      Parameters:
      resolver - the resolver to use to lookup the prefix
      Returns:
      the extended qualified-name
    • toEQName

      @NonNull default String toEQName(@NonNull StaticContext staticContext)
      Generate a qualified name for this QName. Use a prefix resolved from the provided static context, or prepend the namespace if no prefix can be resolved.
      Parameters:
      staticContext - the static context to use to lookup the prefix
      Returns:
      the extended qualified-name
    • toQName

      @NonNull default QName toQName()
      Generate a QName without a namespace prefix.
      Returns:
      the name
    • toQName

      @NonNull default QName toQName(@NonNull String prefix)
      Generate a QName using the provided namespace prefix.
      Parameters:
      prefix - the prefix to use
      Returns:
      the name