Useful with any data access technology.
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public static int | Returns: the unique int resultthe result Collection (can be results)null
but is not expected to contain null elements)Return a unique int result from the given Collection. |
| public static long | Returns: the unique long resultthe result Collection (can be results)null
but is not expected to contain null elements)Return a unique long result from the given Collection. |
| public static <T> T | Returns: the single result objectthe result Collection (can be results)null
and is also expected to contain null elements)Return a single result object from the given Collection. |
| public static <T> T | Returns: the unique result objectthe result Collection (can be results, Class<T> requiredType)null
but is not expected to contain null elements)Return a unique result object from the given Collection. |
| public static <T> Optional | Returns: the single optional result object, orOptional.empty() if nonethe result Collection (can be results)null)Return a single result object from the given Collection. |
| public static <T> Optional | Returns: the single optional result object, orOptional.empty() if nonethe result Stream (can be results)null)Return a single result object from the given Stream. |
| public static <T> Optional | Returns: the single optional result object, orOptional.empty() if nonethe result Iterator (can be results)null)Return a single result object from the given Iterator. |
| public static <T> T | Returns: the single result objectthe result Collection (can be results)null
but is not expected to contain null elements)Return a single result object from the given Collection. |
| public static <T> T | Returns: the unique result objectthe result Collection (can be results)null
but is not expected to contain null elements)Return a unique result object from the given Collection. |
| public static <T> T | Returns: the single result object, ornull if nonethe result Collection (can be results)null)Return a single result object from the given Collection. |
| public static <T> T | Returns: the single result object, ornull if nonethe result Stream (can be results)null)Return a single result object from the given Stream. |
| public static <T> T | Returns: the single result object, ornull if nonethe result Iterator (can be results)null)Return a single result object from the given Iterator. |
| public static RuntimeException | Returns: a translated persistence exception if translation is possible, or the raw exception if it is notan exception that we may wish to translate rawException, PersistenceExceptionTranslator the PersistenceExceptionTranslator to use to perform the translation pet)Return a translated exception if this is appropriate, otherwise return the given exception as-is. |
| public static <T> T | Returns: the unique result object, ornull if nonethe result Collection (can be results)null)Return a unique result object from the given Collection. |
| DataAccessUtils | back to summary |
|---|---|
| public DataAccessUtils() | |
| intResult | back to summary |
|---|---|
| public static int intResult(Collection<?> results) throws IncorrectResultSizeDataAccessException, TypeMismatchDataAccessException Return a unique int result from the given Collection. Throws an exception if 0 or more than 1 result objects found, of if the unique result object is not convertible to an int.
| |
| longResult | back to summary |
|---|---|
| public static long longResult(Collection<?> results) throws IncorrectResultSizeDataAccessException, TypeMismatchDataAccessException Return a unique long result from the given Collection. Throws an exception if 0 or more than 1 result objects found, of if the unique result object is not convertible to a long.
| |
| nullableSingleResult | back to summary |
|---|---|
| public static <T> T nullableSingleResult(Collection<T> results) throws IncorrectResultSizeDataAccessException Return a single result object from the given Collection. Throws an exception if 0 or more than 1 element found.
| |
| objectResult | back to summary |
|---|---|
| public static <T> T objectResult(Collection<?> results, Class<T> requiredType) throws IncorrectResultSizeDataAccessException, TypeMismatchDataAccessException Return a unique result object from the given Collection. Throws an exception if 0 or more than 1 result objects found, of if the unique result object is not convertible to the specified required type.
| |
| optionalResult | back to summary |
|---|---|
| public static <T> Optional Return a single result object from the given Collection. Returns
| |
| optionalResult | back to summary |
|---|---|
| public static <T> Optional Return a single result object from the given Stream. Returns
| |
| optionalResult | back to summary |
|---|---|
| public static <T> Optional Return a single result object from the given Iterator. Returns
| |
| requiredSingleResult | back to summary |
|---|---|
| public static <T> T requiredSingleResult(Collection<T> results) throws IncorrectResultSizeDataAccessException Return a single result object from the given Collection. Throws an exception if 0 or more than 1 element found.
| |
| requiredUniqueResult | back to summary |
|---|---|
| public static <T> T requiredUniqueResult(Collection<T> results) throws IncorrectResultSizeDataAccessException Return a unique result object from the given Collection. Throws an exception if 0 or more than 1 instance found.
| |
| singleResult | back to summary |
|---|---|
| public static <T> T singleResult(Collection<T> results) throws IncorrectResultSizeDataAccessException Return a single result object from the given Collection. Returns
| |
| singleResult | back to summary |
|---|---|
| public static <T> T singleResult(Stream<T> results) throws IncorrectResultSizeDataAccessException Return a single result object from the given Stream. Returns
| |
| singleResult | back to summary |
|---|---|
| public static <T> T singleResult(Iterator<T> results) throws IncorrectResultSizeDataAccessException Return a single result object from the given Iterator. Returns
| |
| translateIfNecessary | back to summary |
|---|---|
| public static RuntimeException translateIfNecessary(RuntimeException rawException, PersistenceExceptionTranslator pet) Return a translated exception if this is appropriate, otherwise return the given exception as-is.
| |
| uniqueResult | back to summary |
|---|---|
| public static <T> T uniqueResult(Collection<T> results) throws IncorrectResultSizeDataAccessException Return a unique result object from the given Collection. Returns
| |