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

io.permazen.ConverterProvider Maven / Gradle / Ivy

There is a newer version: 5.1.0
Show newest version

/*
 * Copyright (C) 2015 Archie L. Cobbs. All rights reserved.
 */

package io.permazen;

import com.google.common.base.Converter;

interface ConverterProvider {

    /**
     * Get a {@link Converter} that converts from what the core database returns to what the Java application expects.
     *
     * @param jtx transaction
     * @return {@link Converter} from core API to Java
     */
    Converter getConverter(JTransaction jtx);

    static ConverterProvider identityForNull(ConverterProvider provider) {
        return jtx -> {
            final Converter converter = provider.getConverter(jtx);
            return converter != null ? converter : Converter.identity();
        };
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy