Class CachedConfigValue<T>

    • Field Detail

      • cachedValue

        @Nullable
        protected T cachedValue
      • parsedTime

        protected long parsedTime
    • Constructor Detail

      • CachedConfigValue

        protected CachedConfigValue​(@NotNull
                                    @NotNull ValueManifest<T> manifest)
    • Method Detail

      • 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.