ru.fix.dynamic.property.api.MappedProperty Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of dynamic-property-api Show documentation
Show all versions of dynamic-property-api Show documentation
https://github.com/ru-fix/dynamic-property
package ru.fix.dynamic.property.api;
import java.util.function.Function;
public class MappedProperty extends AtomicProperty implements DynamicProperty {
private final PropertySubscription subscription;
public MappedProperty(DynamicProperty source, Function map) {
this.subscription = source
.createSubscription()
.setAndCallListener((oldValue, newValue) -> this.set(map.apply(newValue)));
}
@Override
public void close() {
subscription.close();
super.close();
}
}