Package org.hibernate.query.internal
Class ParameterMetadataImpl
- java.lang.Object
-
- org.hibernate.query.internal.ParameterMetadataImpl
-
- All Implemented Interfaces:
ParameterMetadata
,ParameterMetadataImplementor
public class ParameterMetadataImpl extends Object implements ParameterMetadataImplementor
Encapsulates metadata about parameters encountered within a query.
-
-
Field Summary
Fields Modifier and Type Field Description static ParameterMetadataImpl
EMPTY
Singleton access
-
Constructor Summary
Constructors Constructor Description ParameterMetadataImpl(Map<Integer,QueryParameterImplementor<?>> positionalQueryParameters, Map<String,QueryParameterImplementor<?>> namedQueryParameters)
ParameterMetadataImpl(Map<QueryParameterImplementor<?>,List<SqmParameter<?>>> queryParameters)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
containsReference(QueryParameter<?> parameter)
Is this parameter reference registered in this collection?QueryParameterImplementor<?>
findQueryParameter(int positionLabel)
Find the QueryParameter registered under the given position-label, if one.QueryParameterImplementor<?>
findQueryParameter(String name)
Find the QueryParameter registered under the given name, if one.<T> BindableType<T>
getInferredParameterType(QueryParameter<T> parameter)
Set<String>
getNamedParameterNames()
Return the names of all named parameters of the query.Set<Integer>
getOrdinalParameterLabels()
int
getParameterCount()
The total number of registered parameters.QueryParameterImplementor<?>
getQueryParameter(int positionLabel)
Get the QueryParameter reference registered here under the given position-label.QueryParameterImplementor<?>
getQueryParameter(String name)
Get the QueryParameter reference registered here under the given name.Set<QueryParameterImplementor<?>>
getRegistrations()
boolean
hasAnyMatching(Predicate<QueryParameterImplementor<?>> filter)
boolean
hasNamedParameters()
Does this parameter set contain any named parameters?boolean
hasPositionalParameters()
Does this parameter set contain any positional parameters?<P> QueryParameterImplementor<P>
resolve(Parameter<P> param)
A deeper resolution attempt from a JPA parameter reference to Hibernate's contract.void
visitParameters(Consumer<QueryParameterImplementor<?>> consumer)
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.hibernate.query.spi.ParameterMetadataImplementor
collectAllParameters, visitRegistrations
-
-
-
-
Field Detail
-
EMPTY
public static final ParameterMetadataImpl EMPTY
Singleton access
-
-
Constructor Detail
-
ParameterMetadataImpl
public ParameterMetadataImpl(Map<QueryParameterImplementor<?>,List<SqmParameter<?>>> queryParameters)
-
ParameterMetadataImpl
public ParameterMetadataImpl(Map<Integer,QueryParameterImplementor<?>> positionalQueryParameters, Map<String,QueryParameterImplementor<?>> namedQueryParameters)
-
-
Method Detail
-
getParameterCount
public int getParameterCount()
Description copied from interface:ParameterMetadata
The total number of registered parameters.- Specified by:
getParameterCount
in interfaceParameterMetadata
-
getInferredParameterType
public <T> BindableType<T> getInferredParameterType(QueryParameter<T> parameter)
- Specified by:
getInferredParameterType
in interfaceParameterMetadata
-
containsReference
public boolean containsReference(QueryParameter<?> parameter)
Description copied from interface:ParameterMetadata
Is this parameter reference registered in this collection?- Specified by:
containsReference
in interfaceParameterMetadata
-
visitParameters
public void visitParameters(Consumer<QueryParameterImplementor<?>> consumer)
- Specified by:
visitParameters
in interfaceParameterMetadataImplementor
-
getRegistrations
public Set<QueryParameterImplementor<?>> getRegistrations()
- Specified by:
getRegistrations
in interfaceParameterMetadata
-
hasAnyMatching
public boolean hasAnyMatching(Predicate<QueryParameterImplementor<?>> filter)
- Specified by:
hasAnyMatching
in interfaceParameterMetadataImplementor
-
resolve
public <P> QueryParameterImplementor<P> resolve(Parameter<P> param)
Description copied from interface:ParameterMetadata
A deeper resolution attempt from a JPA parameter reference to Hibernate's contract. Generally should return the same param reference. According to the spec, only Parameter references obtained from the provider are valid.- Specified by:
resolve
in interfaceParameterMetadata
- Specified by:
resolve
in interfaceParameterMetadataImplementor
-
hasNamedParameters
public boolean hasNamedParameters()
Description copied from interface:ParameterMetadata
Does this parameter set contain any named parameters?- Specified by:
hasNamedParameters
in interfaceParameterMetadata
- Returns:
true
if there are named parameters;false
otherwise.
-
getNamedParameterNames
public Set<String> getNamedParameterNames()
Description copied from interface:ParameterMetadata
Return the names of all named parameters of the query.- Specified by:
getNamedParameterNames
in interfaceParameterMetadata
- Returns:
- the parameter names
-
findQueryParameter
public QueryParameterImplementor<?> findQueryParameter(String name)
Description copied from interface:ParameterMetadata
Find the QueryParameter registered under the given name, if one.- Specified by:
findQueryParameter
in interfaceParameterMetadata
- Specified by:
findQueryParameter
in interfaceParameterMetadataImplementor
- Returns:
- The registered match, or
null
is there is no match - See Also:
ParameterMetadata.getQueryParameter(String)
-
getQueryParameter
public QueryParameterImplementor<?> getQueryParameter(String name)
Description copied from interface:ParameterMetadata
Get the QueryParameter reference registered here under the given name.- Specified by:
getQueryParameter
in interfaceParameterMetadata
- Specified by:
getQueryParameter
in interfaceParameterMetadataImplementor
- Returns:
- The registered match. Never
null
-
hasPositionalParameters
public boolean hasPositionalParameters()
Description copied from interface:ParameterMetadata
Does this parameter set contain any positional parameters?- Specified by:
hasPositionalParameters
in interfaceParameterMetadata
- Returns:
true
if there are positional parameters;false
otherwise.
-
getOrdinalParameterLabels
public Set<Integer> getOrdinalParameterLabels()
- Specified by:
getOrdinalParameterLabels
in interfaceParameterMetadata
-
findQueryParameter
public QueryParameterImplementor<?> findQueryParameter(int positionLabel)
Description copied from interface:ParameterMetadata
Find the QueryParameter registered under the given position-label, if one.- Specified by:
findQueryParameter
in interfaceParameterMetadata
- Specified by:
findQueryParameter
in interfaceParameterMetadataImplementor
- Returns:
- The registered match, or
null
is there is no match - See Also:
ParameterMetadata.getQueryParameter(int)
-
getQueryParameter
public QueryParameterImplementor<?> getQueryParameter(int positionLabel)
Description copied from interface:ParameterMetadata
Get the QueryParameter reference registered here under the given position-label.- Specified by:
getQueryParameter
in interfaceParameterMetadata
- Specified by:
getQueryParameter
in interfaceParameterMetadataImplementor
- Returns:
- The registered match. Never
null
-
-