All Downloads are FREE. Search and download functionalities are using the official Maven repository.

ru.fix.dynamic.property.api.MappedProperty Maven / Gradle / Ivy

There is a newer version: 2.0.8
Show newest version
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();
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy