Package io.deephaven.base.string.cache
Class AlwaysCreateStringCache<STRING_LIKE_TYPE extends CharSequence>
java.lang.Object
io.deephaven.base.string.cache.AlwaysCreateStringCache<STRING_LIKE_TYPE>
- All Implemented Interfaces:
StringCache<STRING_LIKE_TYPE>
public class AlwaysCreateStringCache<STRING_LIKE_TYPE extends CharSequence>
extends Object
implements StringCache<STRING_LIKE_TYPE>
Dummy StringCache implementation for code that won't benefit from caching, just wants to use the StringCompatible
mechanisms for efficient String creation.
-
Field Summary
Modifier and TypeFieldDescriptionstatic final StringCache<CompressedString>
static final StringCache<MappedCompressedString>
static final StringCache<String>
Fields inherited from interface io.deephaven.base.string.cache.StringCache
CAPACITY_UNBOUNDED
-
Method Summary
Modifier and TypeMethodDescriptionfinal int
capacity()
Get a hint about this cache's capacity and behavior.final STRING_LIKE_TYPE
getCachedString
(@NotNull StringCompatible protoString) final STRING_LIKE_TYPE
getCachedString
(@NotNull String string) final STRING_LIKE_TYPE
final @NotNull Class<STRING_LIKE_TYPE>
getType()
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface io.deephaven.base.string.cache.StringCache
getCachedString
-
Field Details
-
STRING_INSTANCE
-
COMPRESSED_STRING_INSTANCE
-
MAPPED_COMPRESSED_STRING_INSTANCE
-
-
Method Details
-
capacity
public final int capacity()Description copied from interface:StringCache
Get a hint about this cache's capacity and behavior.- Specified by:
capacity
in interfaceStringCache<STRING_LIKE_TYPE extends CharSequence>
- Returns:
- -1 : This is an unbounded cache. 0 : This "cache" doesn't actually perform any caching. >0 : Actual capacity bound.
-
getType
- Specified by:
getType
in interfaceStringCache<STRING_LIKE_TYPE extends CharSequence>
- Returns:
- The type of the elements in this cache.
-
getEmptyString
- Specified by:
getEmptyString
in interfaceStringCache<STRING_LIKE_TYPE extends CharSequence>
- Returns:
- A cached STRING_LIKE_TYPE that represents the empty string.
-
getCachedString
@NotNull public final STRING_LIKE_TYPE getCachedString(@NotNull @NotNull StringCompatible protoString) - Specified by:
getCachedString
in interfaceStringCache<STRING_LIKE_TYPE extends CharSequence>
- Parameters:
protoString
- The string-like CharSequence to look up- Returns:
- A cached STRING_LIKE_TYPE that corresponds to the current value of the CharSequence expressed by protoString
-
getCachedString
- Specified by:
getCachedString
in interfaceStringCache<STRING_LIKE_TYPE extends CharSequence>
- Parameters:
string
- The String to look up- Returns:
- A cached STRING_LIKE_TYPE that corresponds to the CharSequence expressed by string
-