All Implemented Interfaces:
BusinessDomainMapper<LLM,LLMDTO>

public class LLMMapper extends AbstractBusinessDomainMapper<LLM,LLMDTO>
Bidirectional mapper between LLM and LLMDTO.

Caches mappings in both directions and refreshes them when the source side has a newer version. For DTO→BDO, parses the API enum via PromptableApi.valueOf(String). For BDO→DTO, allocates an ID via the inherited idSupplier when no cached DTO exists.

Singleton — access via getInstance().

Since:
1.0
Author:
Felix Seggebäing
  • Method Details

    • getInstance

      public static LLMMapper getInstance()
    • get

      public LLM get(LLMDTO dto)
      Maps an LLMDTO to its LLM counterpart with caching.

      Returns the cached BDO if present and up to date; otherwise creates a new LLM from the DTO fields (converting api via PromptableApi.valueOf(String)), updates the bidirectional cache, and returns it.

      Parameters:
      dto - the source DTO; may be null
      Returns:
      the mapped LLM, or null if dto is null
      Implementation Note:
      The cache is refreshed when the DTO's version is newer than the cached BDO's version.
    • get

      public LLMDTO get(LLM bdo)
      Maps an LLM business object to its LLMDTO with caching.

      Returns the cached DTO if present and up to date; otherwise creates a new DTO, reusing the existing ID if cached or allocating one via idSupplier if not. The cache is refreshed when the BDO's version is newer than the cached DTO's.

      Parameters:
      bdo - the source business object; may be null
      Returns:
      the mapped LLMDTO, or null if bdo is null