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

com.noodlesandwich.rekord.keys.NamedKey Maven / Gradle / Ivy

package com.noodlesandwich.rekord.keys;

import com.noodlesandwich.rekord.Key;
import com.noodlesandwich.rekord.Properties;
import com.noodlesandwich.rekord.Property;
import com.noodlesandwich.rekord.transformers.Transformer;

public final class NamedKey extends Key {
    private final String name;

    public NamedKey(String name) {
        this.name = name;
    }

    @Override
    public  Key that(Transformer transformer) {
        return new TransformingKey<>(this, transformer);
    }

    @Override
    public Properties storeTo(Properties properties, V value) {
        return properties.with(new Property<>(this, value));
    }

    @SuppressWarnings("unchecked")
    @Override
    public V retrieveFrom(Properties properties) {
        return (V) properties.get(this);
    }

    @Override
    public String toString() {
        return name;
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy