kotlin.reflect.jvm.internal.impl.storage.ObservableStorageManager.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of kotlin-reflect Show documentation
Show all versions of kotlin-reflect Show documentation
Kotlin Full Reflection Library
/*
* Copyright 2010-2015 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package kotlin.reflect.jvm.internal.impl.storage
import java.util.concurrent.ConcurrentMap
abstract class ObservableStorageManager(private val delegate: StorageManager) : StorageManager {
protected abstract val (() -> T).observable: () -> T
protected abstract val ((K) -> V).observable: (K) -> V
override fun createMemoizedFunction(compute: (K) -> V): MemoizedFunctionToNotNull {
return delegate.createMemoizedFunction(compute.observable)
}
override fun createMemoizedFunctionWithNullableValues(compute: (K) -> V?): MemoizedFunctionToNullable {
return delegate.createMemoizedFunctionWithNullableValues(compute.observable)
}
override fun createMemoizedFunction(compute: (K) -> V, map: ConcurrentMap): MemoizedFunctionToNotNull {
return delegate.createMemoizedFunction(compute.observable, map)
}
override fun createMemoizedFunctionWithNullableValues(compute: (K) -> V, map: ConcurrentMap): MemoizedFunctionToNullable {
return delegate.createMemoizedFunctionWithNullableValues(compute.observable, map)
}
override fun createCacheWithNullableValues(): CacheWithNullableValues {
return delegate.createCacheWithNullableValues()
}
override fun createCacheWithNotNullValues(): CacheWithNotNullValues {
return delegate.createCacheWithNotNullValues()
}
override fun createLazyValue(computable: () -> T): NotNullLazyValue {
return delegate.createLazyValue(computable.observable)
}
override fun createLazyValue(computable: () -> T, onRecursiveCall: (Boolean) -> T): NotNullLazyValue {
return delegate.createLazyValue(computable.observable, onRecursiveCall)
}
override fun createRecursionTolerantLazyValue(computable: () -> T, onRecursiveCall: T): NotNullLazyValue {
return delegate.createRecursionTolerantLazyValue(computable.observable, onRecursiveCall)
}
override fun createLazyValueWithPostCompute(computable: () -> T, onRecursiveCall: ((Boolean) -> T)?, postCompute: (T) -> Unit): NotNullLazyValue {
return delegate.createLazyValueWithPostCompute(computable.observable, onRecursiveCall, postCompute)
}
override fun createNullableLazyValue(computable: () -> T?): NullableLazyValue {
return delegate.createNullableLazyValue(computable.observable)
}
override fun createRecursionTolerantNullableLazyValue(computable: () -> T?, onRecursiveCall: T?): NullableLazyValue {
return delegate.createRecursionTolerantNullableLazyValue(computable.observable, onRecursiveCall)
}
override fun createNullableLazyValueWithPostCompute(computable: () -> T?, postCompute: (T?) -> Unit): NullableLazyValue {
return delegate.createNullableLazyValueWithPostCompute(computable.observable, postCompute)
}
override fun compute(computable: () -> T): T {
return delegate.compute(computable.observable)
}
}