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

com.athaydes.protobuf.tcp.api.ServicePropertyReader Maven / Gradle / Ivy

package com.athaydes.protobuf.tcp.api;

import com.athaydes.protobuf.tcp.internal.Utils;
import java.util.Map;
import java.util.Optional;
import java.util.OptionalInt;

/**
 * Helper for reading service properties from a {@link Map}.
 */
public interface ServicePropertyReader {

    /**
     * Read a String property from the given map.
     *
     * @param map with service properties
     * @param key the property key
     * @return the value of the property with the given key, or none if not available
     */
    Optional getStringFrom(Map map, String key);

    /**
     * Read a {@code int} property from the given map.
     * 

* If the property is present but is not an integer or a String that can be parsed as an integer, a * {@link NumberFormatException} exception is thrown. * * @param map with service properties * @param key the property key * @return the value of the property with the given key, or none if not available */ OptionalInt getIntFrom(Map map, String key); /** * @return the default implementation of {@link ServicePropertyReader}. */ static ServicePropertyReader getDefault() { return new Utils(); } }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy