HHH-5881 - Add getter for "namedParameters" to QueryKey

This commit is contained in:
Steve Ebersole 2012-05-30 11:03:19 -05:00
parent dddc959311
commit c8431ce5d9
1 changed files with 17 additions and 10 deletions

View File

@ -25,6 +25,7 @@ package org.hibernate.cache.spi;
import java.io.IOException;
import java.io.Serializable;
import java.util.Collections;
import java.util.Map;
import java.util.Set;
@ -54,7 +55,7 @@ public class QueryKey implements Serializable {
private final String tenantIdentifier;
private final Set filterKeys;
// the user provided resulttransformer, not the one used with "select new". Here to avoid mangling
// the explicit user-provided result transformer, not the one used with "select new". Here to avoid mangling
// transformed/non-transformed results.
private final CacheableResultTransformer customTransformer;
@ -174,10 +175,25 @@ public class QueryKey implements Serializable {
this.hashCode = generateHashCode();
}
/**
* Provides access to the explicitly user-provided result transformer.
*
* @return The result transformer.
*/
public CacheableResultTransformer getResultTransformer() {
return customTransformer;
}
/**
* Provide (unmodifiable) access to the named parameters that are part of this query.
*
* @return The (unmodifiable) map of named parameters
*/
@SuppressWarnings("unchecked")
public Map getNamedParameters() {
return Collections.unmodifiableMap( namedParameters );
}
/**
* Deserialization hook used to re-init the cached hashcode which is needed for proper clustering support.
*
@ -206,9 +222,6 @@ public class QueryKey implements Serializable {
return result;
}
/**
* {@inheritDoc}
*/
@Override
public boolean equals(Object other) {
if ( !( other instanceof QueryKey ) ) {
@ -251,17 +264,11 @@ public class QueryKey implements Serializable {
&& EqualsHelper.equals( tenantIdentifier, that.tenantIdentifier );
}
/**
* {@inheritDoc}
*/
@Override
public int hashCode() {
return hashCode;
}
/**
* {@inheritDoc}
*/
@Override
public String toString() {
StringBuilder buffer = new StringBuilder( "sql: " ).append( sqlQueryString );