Class DataPathSegmentsTranslationCache

java.lang.Object
com.e1c.langtool.v8.dt.translator.AbstractStringTranslationCache
com.e1c.langtool.v8.dt.form.translator.DataPathSegmentsTranslationCache
All Implemented Interfaces:
SessionCache

public class DataPathSegmentsTranslationCache extends AbstractStringTranslationCache
Cache holds translation of all AbstractDataPath segments for every form
  • Constructor Details

    • DataPathSegmentsTranslationCache

      public DataPathSegmentsTranslationCache()
  • Method Details

    • init

      public void init(IProjectTranslationProvider translationProvider)
      Initialize the cache with translation provider on cache creation.
      Parameters:
      translationProvider - the translation provider
    • getTranslation

      public @Nullable List<String> getTranslation(@NonNull AbstractDataPath source)
      Gets the translation of segment from cache without computing it if not exits.
      Parameters:
      source - the source, cannot be null
      Returns:
      the translation of segments, can return null if cache doesn't have translation
    • getOrComputeTranslation

      public @Nullable List<String> getOrComputeTranslation(@NonNull AbstractDataPath source)
      Gets the or compute translation of segmets by givin data path.
      Parameters:
      source - the source data path, cannot be null
      Returns:
      stored or computed translation of segments, can return null if cannot get or compute translation
    • getTranslation

      public @Nullable List<String> getTranslation(@NonNull AbstractDataPath source, @NonNull com.google.inject.Provider<List<String>> provider)
      Gets the translation of segments form cache or compute translation by the proiver and store it in cache.
      Parameters:
      source - the source, cannot be null
      provider - the provider of translates segments, cannot be null
      Returns:
      the translation of segments form cache or from provider, can return null if cannot get or compute translation
    • getTranslation

      public @Nullable List<String> getTranslation(@NonNull org.eclipse.emf.common.util.URI formUri, @NonNull List<String> segments, @NonNull com.google.inject.Provider<List<String>> provider)
      Gets the translation.
      Parameters:
      formUri - the form uri, cannot be null
      segments - the source segments, cannot be null
      provider - the provider to compute translation, cannot be null
      Returns:
      the translation of sermgent from cache or from provider, can return null if cannot get or compute translation
    • getTranslation

      public @Nullable List<String> getTranslation(@NonNull org.eclipse.emf.common.util.URI formUri, @NonNull List<String> segments)
      Gets the translation of segments that stored in cache.
      Parameters:
      formUri - the form uri, cannot be null
      segments - the source segments, cannot be null
      Returns:
      the translation of segments, can return null if not exists