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

io.axway.iron.ReadonlyTransaction Maven / Gradle / Ivy

The newest version!
package io.axway.iron;

import java.util.*;
import javax.annotation.*;
import io.axway.iron.error.ObjectNotFoundException;
import io.axway.iron.functional.Accessor;

/**
 * The read only transaction permit to read the store model through the {{@link #select(Class)} method.
* Many read only transaction can be performed simultaneously but no command execution is performed at the same. */ public interface ReadonlyTransaction { /** * @param entityClass the entity class of the instance(s) to be loaded * @param the type corresponding to the entity class (automatically inferred) * @return a fluent interface to continue the call */ From select(Class entityClass); interface From { /** * Load all the instances of an entity. * * @return a collection that contains all the instances of the selected entity */ Collection all(); /** * Permit to lookup some specific instance based on a unique constraint. * * @param accessor the accessor that correspond to the unique constraint member * @param the type of the unique constraint * @return a fluent interface to continue the call */ On where(Accessor accessor); } interface On { /** * Load exactly one instance of the selected entity. * * @param value a single value to be looked for * @return the instance that match the constraint * @throws ObjectNotFoundException in case no instance fulfilling the constraint has been found */ E equalsTo(V value); /** * Load one instance of the selected entity if exists. * * @param value a single value to be looked for * @return the instance that match the constraint or {@code null} if no instance is matching */ @Nullable E equalsToOrNull(V value); /** * Load many instances of the selected entity. * * @param values values to be looked for * @return a collection that contains matched instances. The matched instances are in the same order than the {@code values}, so the returned collection has the same size than {@code values} * @throws ObjectNotFoundException in case no instance fulfilling one of the values */ Collection allContainedIn(Collection values); /** * Load many instances of the selected entity. * * @param values values to be looked for * @return a collection that contains matched instances. The matched instances are in the same order than the {@code values}, in case a value is not matched it doesn't add an entry in the result. So the returned collection has size equals or smaller than {@code values}. */ Collection someContainedIn(Collection values); } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy