Class ConfigKey

java.lang.Object
com.oracle.coherence.rag.config.ConfigKey
All Implemented Interfaces:
PortableObject

public class ConfigKey extends Object implements PortableObject
A composite configuration key used to address configuration entries in a distributed Coherence NamedMap.

The key consists of two parts:

  • key – a required opaque component that uniquely identifies a configuration subject. For model configuration, the recommended format is "{type}:{provider}/{model}" (for example, "chat:OpenAI/gpt-4o-mini", "embedding:OpenAI/text-embedding-3-small").
  • storeName – an optional context component that, when present, scopes the configuration to a specific store (for example, "docs"). A null store name indicates a global configuration that applies across all stores.

Equality and hashing include both the opaque key and the optional store name, allowing concurrent global and store-scoped entries for the same subject to coexist without collision.

This class implements Coherence POF PortableObject to enable efficient serialization and cross-version evolution. The class is intentionally minimal and immutable by convention once constructed.

Since:
25.09
Author:
Aleks Seovic 2025.08.06
  • Constructor Details

    • ConfigKey

      public ConfigKey()
      No-arg constructor for POF deserialization.
    • ConfigKey

      public ConfigKey(Object oKey)
      Creates a new ConfigKey for a global (store-agnostic) entry.
      Parameters:
      oKey - the required opaque key; must not be null
    • ConfigKey

      public ConfigKey(Object oKey, String storeName)
      Creates a new ConfigKey for a store-scoped entry.
      Parameters:
      oKey - the required opaque key; must not be null
      storeName - the optional store name; null for global scope
  • Method Details

    • key

      public Object key()
      Returns the opaque key component identifying a configuration subject.
      Returns:
      the opaque key component; never null for valid instances
    • storeName

      public String storeName()
      Returns the optional store name that scopes this configuration.
      Returns:
      the store name, or null if this key represents a global configuration
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

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

      public void readExternal(PofReader in) throws IOException
      Description copied from interface: PortableObject
      Restore the contents of a user type instance by reading its state using the specified PofReader object.
      Specified by:
      readExternal in interface PortableObject
      Parameters:
      in - the PofReader from which to read the object's state
      Throws:
      IOException - if an I/O error occurs
    • writeExternal

      public void writeExternal(PofWriter out) throws IOException
      Description copied from interface: PortableObject
      Save the contents of a POF user type instance by writing its state using the specified PofWriter object.
      Specified by:
      writeExternal in interface PortableObject
      Parameters:
      out - the PofWriter to which to write the object's state
      Throws:
      IOException - if an I/O error occurs