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

com.kenshoo.pl.entity.FieldsValueMap 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;

/**
 * The interface of any field -> value collection.
 */
public interface FieldsValueMap> {

    /**
     * Returns true is the map has a value for the given field
     */
     boolean containsField(EntityField field);

    /**
     * Returns the value of the specified field.
     *
     * @param field field to query
     * @param    type of the field
     * @return the value of the field. Can be null.
     * @throws RuntimeException if the field is not present in the map
     */
     T get(EntityField field);

    /**
     * @param field field whose value should be fetched
     * @param  the type of the value in the field
     * @return the field value if not-null; or Triptional.nullInstance() if null; or Triptional.absent() if the field doesn't exist
     */
    default  Triptional safeGet(final EntityField field) {
        if (containsField(field)) {
            return Triptional.of(get(field));
        }
        return Triptional.absent();
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy