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

org.dellroad.querystream.jpa.IntValue Maven / Gradle / Ivy

The newest version!

/*
 * Copyright (C) 2018 Archie L. Cobbs. All rights reserved.
 */

package org.dellroad.querystream.jpa;

import jakarta.persistence.FlushModeType;
import jakarta.persistence.LockModeType;
import jakarta.persistence.NoResultException;
import jakarta.persistence.Parameter;
import jakarta.persistence.TemporalType;
import jakarta.persistence.criteria.Expression;
import jakarta.persistence.criteria.Selection;

import java.util.Calendar;
import java.util.Date;
import java.util.Map;
import java.util.function.Consumer;
import java.util.function.Function;

/**
 * A int {@link ExprValue}.
 */
public interface IntValue extends ExprValue>, IntStream {

    /**
     * Build and evaluate a JPA query based on this instance and return the single non-NULL result.
     *
     * 

* This variant of {@link #value} is useful when it is known that NULL won't be returned. * * @return result of executed query * @throws NoResultException if the query returns NULL */ default int intValue() { final Integer value = this.value(); if (value == null) throw new NoResultException("NULL value returned from query"); return (int)value; } // Narrowing overrides (QueryStream) @Override IntValue bind(Ref> ref); @Override IntValue peek(Consumer> peeker); @Override > IntValue bind( Ref ref, Function, ? extends S2> refFunction); @Override IntValue filter(Function, ? extends Expression> predicateBuilder); @Override IntValue withFlushMode(FlushModeType flushMode); @Override IntValue withLockMode(LockModeType lockMode); @Override IntValue withHint(String name, Object value); @Override IntValue withHints(Map hints); @Override IntValue withParam(Parameter parameter, T value); @Override IntValue withParam(Parameter parameter, Date value, TemporalType temporalType); @Override IntValue withParam(Parameter parameter, Calendar value, TemporalType temporalType); @Override IntValue withParams(Iterable> params); @Override IntValue withLoadGraph(String name); @Override IntValue withFetchGraph(String name); }





© 2015 - 2025 Weber Informatics LLC | Privacy Policy