public abstract class AbstractAnsiTrimEmulationFunction extends Object implements SQLFunction
A SQLFunction providing support for implementing TRIM functionality
(as defined by both the ANSI SQL and JPA specs) in cases where the dialect may not support the full <tt>trim</tt>
function itself.
<p/>
Follows the <a href="http://en.wikipedia.org/wiki/Template_method_pattern">template</a> pattern in order to implement
the render(org.hibernate.type.Type, java.util.List, org.hibernate.engine.spi.SessionFactoryImplementor) method.
| Constructor and Description |
|---|
AbstractAnsiTrimEmulationFunction() |
| Modifier and Type | Method and Description |
|---|---|
Type |
getReturnType(Type argumentType,
Mapping mapping)
The return type of the function.
|
boolean |
hasArguments()
Does this function have any arguments?
|
boolean |
hasParenthesesIfNoArguments()
If there are no arguments, are parentheses required?
|
String |
render(Type argumentType,
List args,
SessionFactoryImplementor factory)
Render the function call as SQL fragment.
|
protected abstract SQLFunction |
resolveBothSpaceTrimFromFunction()
Resolve the function definition which should be used to trim both leading and trailing spaces.
|
protected abstract SQLFunction |
resolveBothSpaceTrimFunction()
Resolve the function definition which should be used to trim both leading and trailing spaces.
|
protected abstract SQLFunction |
resolveBothTrimFunction()
Resolve the function definition which should be used to trim the specified character from both the
beginning (leading) and end (trailing) of the trim source.
|
protected abstract SQLFunction |
resolveLeadingSpaceTrimFunction()
Resolve the function definition which should be used to trim leading spaces.
|
protected abstract SQLFunction |
resolveLeadingTrimFunction()
Resolve the function definition which should be used to trim the specified character from the
beginning (leading) of the trim source.
|
protected abstract SQLFunction |
resolveTrailingSpaceTrimFunction()
Resolve the function definition which should be used to trim trailing spaces.
|
protected abstract SQLFunction |
resolveTrailingTrimFunction()
Resolve the function definition which should be used to trim the specified character from the
end (trailing) of the trim source.
|
public final boolean hasArguments()
SQLFunctionDoes this function have any arguments?
hasArguments in interface SQLFunctionpublic final boolean hasParenthesesIfNoArguments()
SQLFunctionIf there are no arguments, are parentheses required?
hasParenthesesIfNoArguments in interface SQLFunctionpublic final Type getReturnType(Type argumentType, Mapping mapping) throws QueryException
SQLFunctionThe return type of the function. May be either a concrete type which is preset, or variable depending upon
the type of the first function argument.
<p/>
Note, the 'firstArgumentType' parameter should match the one passed into SQLFunction.render(org.hibernate.type.Type, java.util.List, org.hibernate.engine.spi.SessionFactoryImplementor)
getReturnType in interface SQLFunctionargumentType - The type of the first argumentmapping - The mapping source.QueryException - Indicates an issue resolving the return type.public final String render(Type argumentType, List args, SessionFactoryImplementor factory) throws QueryException
SQLFunctionRender the function call as SQL fragment.
<p/>
Note, the 'firstArgumentType' parameter should match the one passed into SQLFunction.getReturnType(org.hibernate.type.Type, org.hibernate.engine.spi.Mapping)
render in interface SQLFunctionargumentType - The type of the first argumentargs - The function argumentsfactory - The SessionFactoryQueryException - Indicates a problem rendering the
function call.protected abstract SQLFunction resolveBothSpaceTrimFunction()
Resolve the function definition which should be used to trim both leading and trailing spaces. <p/> In this form, the imput arguments is missing the <tt>FROM</tt> keyword.
protected abstract SQLFunction resolveBothSpaceTrimFromFunction()
Resolve the function definition which should be used to trim both leading and trailing spaces.
<p/>
The same as {#link resolveBothSpaceTrimFunction} except that here the<tt>FROM</tt> is included and
will need to be accounted for during SQLFunction.render(org.hibernate.type.Type, java.util.List, org.hibernate.engine.spi.SessionFactoryImplementor) processing.
protected abstract SQLFunction resolveLeadingSpaceTrimFunction()
Resolve the function definition which should be used to trim leading spaces.
protected abstract SQLFunction resolveTrailingSpaceTrimFunction()
Resolve the function definition which should be used to trim trailing spaces.
protected abstract SQLFunction resolveBothTrimFunction()
Resolve the function definition which should be used to trim the specified character from both the beginning (leading) and end (trailing) of the trim source.
protected abstract SQLFunction resolveLeadingTrimFunction()
Resolve the function definition which should be used to trim the specified character from the beginning (leading) of the trim source.
protected abstract SQLFunction resolveTrailingTrimFunction()
Resolve the function definition which should be used to trim the specified character from the end (trailing) of the trim source.
Copyright © 2001-2018 Red Hat, Inc. All Rights Reserved.