Annotation Type TxUpdateFilterCache.TxCacheUpdatePolicy


  • @Retention(SOURCE)
    public static @interface TxUpdateFilterCache.TxCacheUpdatePolicy
    Update policy that specifies the way that the internal cache is updated with new translations.

    You can find an easy to understand table containing a number of cases and how each policy updates the cache below:

         
     | Key || Cache | New  || Replace All   | Update using Translated        |
     |-----||-------|------||---------------|--------------------------------|
     | a   || "a"   | -    || -             | "a"                            |
     | b   || "b"   | "B"  || "B"           | "B"                            |
     | c   || "c"   | ""   || ""            | "c"                            |
     | d   || ""    | -    || -             | ""                             |
     | e   || ""    | "E"  || "E"           | "E"                            |
     | f   || -     | "F"  || "F"           | "F"                            |
     | g   || -     | ""   || ""            | -                              |
     
     
    Here's an example on how to read the table above:
    • given a string with key="c"
    • and a cache that has "c" as the stored value for this key ("c" -> "c")
    • if an empty translation arrives for this string ("")
      • if policy is REPLACE_ALL, then the cache will be updated so that ("c" -> "")
      • in contrast to that, if policy is UPDATE_USING_TRANSLATED, then the cache will stay as is ("c" -> "c"), because the new translation is empty
    A "-" value means that the respective key does not exist. For example:
    • given a string with key="f"
    • and a cache that has no entry with "f" as a key
    • if a translation arrives for this string ("f" -> "F")
      • if policy is REPLACE_ALL, then the cache will be updated by adding a new entry so that ("f" -> "F")
      • if policy is UPDATE_USING_TRANSLATED, then the same will happen, since the new translation is not empty
    • Field Summary

      Fields 
      Modifier and Type Fields Description
      static int REPLACE_ALL
      Discards the existing cache entries completely and populates the cache with the new entries, even if they contain empty translations.
      static int UPDATE_USING_TRANSLATED
      Updates the existing cache with the new entries that have a non-empty translation.
    • Field Detail

      • REPLACE_ALL

        static final int REPLACE_ALL
        Discards the existing cache entries completely and populates the cache with the new entries, even if they contain empty translations.
      • UPDATE_USING_TRANSLATED

        static final int UPDATE_USING_TRANSLATED
        Updates the existing cache with the new entries that have a non-empty translation.