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

com.kenshoo.pl.entity.spi.audit.DBAdapterAuditFieldValueFormatter Maven / Gradle / Ivy

Go to download

A Java persistence layer based on JOOQ for high performance and business flow support.

There is a newer version: 0.1.121-jooq-3.16.3
Show newest version
package com.kenshoo.pl.entity.spi.audit;

import com.kenshoo.pl.entity.EntityField;

import java.util.Objects;

import static java.util.Objects.requireNonNull;
import static java.util.stream.Collectors.joining;

/**
 * A formatter for audit field values which converts the value into its DB representation using the
 * {@link com.kenshoo.pl.entity.EntityFieldDbAdapter} defined for the entity, and finally to a string.
* The DB adapter uses the {@link com.kenshoo.pl.entity.ValueConverter} defined for the entity to perform the conversion.
* If no such converter is defined, the default string representation of the value is returned.
* Note that there could be more than one DB value mapped to a single entity value, and in that case the values will be joined by a semicolon. */ public class DBAdapterAuditFieldValueFormatter implements AuditFieldValueFormatter { @Override public String format(final EntityField field, final T value) { requireNonNull(field, "A field is required"); requireNonNull(value, "A value is required"); return field.getDbAdapter() .getDbValues(value) .map(Objects::toString) .collect(joining(";")); } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy