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

dev.vality.woody.api.trace.context.metadata.MetadataConverter Maven / Gradle / Ivy

There is a newer version: 2.0.8
Show newest version
package dev.vality.woody.api.trace.context.metadata;

public interface MetadataConverter {
    /**
     * @throws MetadataConversionException if conversion error occurs
     */
    T convertToObject(String key, String value) throws MetadataConversionException;

    /**
     * @throws MetadataConversionException if conversion error occurs
     */
    String convertToString(String key, T value) throws MetadataConversionException;

    /**
     * @return true - if converter can process entry with such key; false - otherwise
     */
    boolean apply(String key);

    /**
     * @return true - if converter accepts absence of any entries that can be applied for conversion to object;
     *      false - otherwise
     */
    default boolean applyToObject() {
        return false;
    }

    /**
     * @return true - if converter accepts absence of any entries that can be applied for conversion to string;
     *      false - otherwise
     */
    default boolean applyToString() {
        return false;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy