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

com.raynigon.unit_api.jackson.UnitApiJacksonProperties Maven / Gradle / Ivy

There is a newer version: 1.1.7
Show newest version
package com.raynigon.unit_api.jackson;

import com.raynigon.unit_api.jackson.config.UnitApiFeature;
import org.springframework.boot.context.properties.ConfigurationProperties;

import java.util.EnumMap;
import java.util.Map;
import java.util.Set;
import java.util.stream.Collectors;

@ConfigurationProperties(prefix="spring.jackson.unit-api")
public class UnitApiJacksonProperties {

    private Map features = new EnumMap<>(UnitApiFeature.class);

    public void setFeatures(Map features) {
        this.features = features;
    }

    public Map getFeatures() {
        return features;
    }

    public Set getEnabledFeatures(){
        return features.entrySet().stream()
                .filter(Map.Entry::getValue)
                .map(Map.Entry::getKey)
                .collect(Collectors.toSet());
    }

    public Set getDisabledFeatures(){
        return features.entrySet().stream()
                .filter(it->!it.getValue())
                .map(Map.Entry::getKey)
                .collect(Collectors.toSet());
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy