Interface StringCacheTypeAdapter<STRING_LIKE_TYPE extends CharSequence>

All Known Implementing Classes:
StringCacheTypeAdapterCompressedStringImpl, StringCacheTypeAdapterMappedCompressedStringImpl, StringCacheTypeAdapterStringImpl

public interface StringCacheTypeAdapter<STRING_LIKE_TYPE extends CharSequence>
Abstracts type-specific functionality for use by StringCache implementations.
  • Method Details

    • getType

      @NotNull @NotNull Class<STRING_LIKE_TYPE> getType()
      Returns:
      The Class of the STRING_LIKE_TYPE instances created by this adapter.
    • empty

      @NotNull STRING_LIKE_TYPE empty()
      Returns:
      The implementation-appropriate empty STRING_LIKE_TYPE instance.
    • create

      @NotNull STRING_LIKE_TYPE create(@NotNull @NotNull String string)
      Note: StringCache implementations may choose not hold a lock while invoking this method.
      Parameters:
      string - The input String
      Returns:
      A newly allocated STRING_LIKE_TYPE with the same content as string.
    • create

      @NotNull STRING_LIKE_TYPE create(@NotNull @NotNull StringCompatible protoString)
      Note: StringCache implementations may choose not hold a lock while invoking this method.
      Parameters:
      protoString - The input StringCompatible
      Returns:
      A newly allocated STRING_LIKE_TYPE with the same content as protoString.
    • areEqual

      boolean areEqual(@NotNull @NotNull CharSequence key, @NotNull STRING_LIKE_TYPE value)
      Compare key (Assumed to be a String *or* a StringCompatible) with value (created by this factory).
      Parameters:
      key - The key
      value - The value
      Returns:
      True iff key and value are equal (according to StringCompatible's implementation).