Interface TranslationFieldTransformerHandler

All Superinterfaces:
org.springframework.core.Ordered

public interface TranslationFieldTransformerHandler extends org.springframework.core.Ordered

By default, during DefaultTranslationEntityService.bulkReplaceTranslationsForEntityInLocale(String, Object, String, Locale, List, ContextInfo), there is a mechanism to transform the Translation.getEntityField() path of collection to 'upgrade' it to try and use ID-based paths for collection members instead of index-based paths.

This is a mechanism that can be used to override this default path transforming behavior with another approach. DefaultTranslationEntityService will delegate to the first TranslationFieldTransformerHandler it finds that can handle the given request. Otherwise, it will fall back to its default transformation logic.

Since:
TranslationCommon 2.0.5
See Also:
  • Field Summary

    Fields inherited from interface org.springframework.core.Ordered

    HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE
  • Method Summary

    Modifier and Type
    Method
    Description
    <P extends Translation>
    boolean
    canHandle(String entityType, Object entity, P translation)
    Check if this handler should handle the translation field transformation for this entity.
    default int
     
    <P extends Translation>
    void
    handle(String entityType, Object entity, P translation)
    Handles translation field transformation for the given translation on the entity
  • Method Details

    • handle

      <P extends Translation> void handle(@NonNull String entityType, @NonNull Object entity, @NonNull P translation)
      Handles translation field transformation for the given translation on the entity
      Parameters:
      entityType - - type of the entity that the translation is for
      entity - - entity instance
      translation - - translation instance
    • canHandle

      <P extends Translation> boolean canHandle(@NonNull String entityType, @NonNull Object entity, @NonNull P translation)
      Check if this handler should handle the translation field transformation for this entity.
      Parameters:
      entityType - - type of the entity that the translation is for
      entity - - entity instance
      translation - - translation instance
      Returns:
      whether it can handle the translation field transformation for this entity
    • getOrder

      default int getOrder()
      Specified by:
      getOrder in interface org.springframework.core.Ordered