All Implemented Interfaces:
BusinessDomainMapper<Prompt,PromptDTO>

public class PromptMapper extends AbstractBusinessDomainMapper<Prompt,PromptDTO>
Bidirectional mapper between Prompt and PromptDTO.

Maintains BDO↔DTO caches and refreshes entries when the source side has a newer version. Resolves referenced objects via SampleQueryMapper/PromptTypeMapper and their DAOs. Singleton — access via getInstance().

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

    • getInstance

      public static PromptMapper getInstance()
    • get

      public Prompt get(PromptDTO dto)
      Maps a PromptDTO to a Prompt with caching.

      Resolves referenced entities (sample query, prompt type) via their DAOs and mappers. Refreshes the cached mapping if the DTO has a newer version.

      Parameters:
      dto - the source DTO; may be null
      Returns:
      the mapped Prompt, or null if dto is null
    • get

      public PromptDTO get(Prompt bdo)
      Maps a Prompt to its PromptDTO with caching.

      Reuses the cached DTO if up to date; otherwise creates a new DTO, reusing the cached ID or allocating one via idSupplier. Maps referenced sample query and prompt type; stores -1 if a reference is null or cannot be mapped.

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