io.permazen.ConverterProvider Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of permazen-main Show documentation
Show all versions of permazen-main Show documentation
Permazen classes that map Java model classes onto the core API.
/*
* 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