Class CachedConfigValue<T,U>

java.lang.Object
cc.carm.lib.configuration.value.ValueManifest<T,U>
cc.carm.lib.configuration.value.ConfigValue<T,U>
cc.carm.lib.configuration.value.impl.CachedConfigValue<T,U>
Direct Known Subclasses:
ConfiguredList, ConfiguredMap, ConfiguredValue

public abstract class CachedConfigValue<T,U> extends ConfigValue<T,U>
  • Field Details

    • cachedValue

      @Nullable protected T cachedValue
    • parsedTime

      protected long parsedTime
  • Constructor Details

    • CachedConfigValue

      protected CachedConfigValue(@NotNull @NotNull ValueManifest<T,U> manifest)
  • Method Details

    • updateCache

      protected T updateCache(T value)
    • getCachedValue

      @Nullable public T getCachedValue()
    • cacheExpired

      public boolean cacheExpired()
    • getDefaultFirst

      protected final T getDefaultFirst(@Nullable T value)
    • getCachedOrDefault

      @Nullable protected T getCachedOrDefault()
      Get the cached value or the default value if the cached value is null
      Returns:
      the cached value or the default value
    • getCachedOrDefault

      @Contract("!null->!null") protected T getCachedOrDefault(@Nullable T emptyValue)
      Get the cached value or the default value if the cached value is null
      Parameters:
      emptyValue - the value to return if the cached value and the default value are null
      Returns:
      the cached value or the default value
    • parserFor

      @Nullable protected <O> @Nullable ValueParser<O> parserFor(@NotNull @NotNull ValueAdapter<O> adapter)
      Type Parameters:
      O - Base object type
      Parameters:
      adapter - Value adapter
      Returns:
      Value's parser, parse base object to value.
    • serializerFor

      @Nullable protected <O> @Nullable ValueSerializer<O> serializerFor(@NotNull @NotNull ValueAdapter<O> adapter)
      Type Parameters:
      O - Base object type
      Parameters:
      adapter - Value adapter
      Returns:
      Value's serializer, parse value to base object.