Package com.blazebit.persistence.spi
Interface JpqlFunction
public interface JpqlFunction
Interface for implementing a JPA custom function that renders dbms specific code.
An instance of this interface needs to be registered to be able to use the function in queries.
- Since:
- 1.0.0
- Author:
- Christian Beikov
- See Also:
EntityManagerFactoryIntegrator.registerFunctions(javax.persistence.EntityManagerFactory, java.util.Map)
-
Method Summary
Modifier and Type Method Description Class<?>getReturnType(Class<?> firstArgumentType)Returns the return type of this function.booleanhasArguments()Returns true if the function has arguments, false otherwise.booleanhasParenthesesIfNoArguments()Returns false if parentheses might be skipped if no arguments are given, true otherwise.voidrender(FunctionRenderContext context)Renders the function into the given function render context.
-
Method Details
-
hasArguments
boolean hasArguments()Returns true if the function has arguments, false otherwise.- Returns:
- true if the function has arguments, false otherwise
-
hasParenthesesIfNoArguments
boolean hasParenthesesIfNoArguments()Returns false if parentheses might be skipped if no arguments are given, true otherwise.- Returns:
- false if parentheses might be skipped if no arguments are given, true otherwise
-
getReturnType
Returns the return type of this function. The return type may be null, but beware that nesting this function into other expressions may then fail.- Parameters:
firstArgumentType- The type of the first argument- Returns:
- the return type of this function, or null
-
render
Renders the function into the given function render context.- Parameters:
context- The context into which the function should be rendered
-