FileDocCategorySizeDatePackage
FilterKey.javaAPI DocHibernate 3.2.52027Mon Dec 05 16:37:00 GMT 2005org.hibernate.cache

FilterKey

public final class FilterKey extends Object implements Serializable
Allows cached queries to be keyed by enabled filters.
author
Gavin King

Fields Summary
private String
filterName
private Map
filterParameters
Constructors Summary
public FilterKey(String name, Map params, Map types, org.hibernate.EntityMode entityMode)

	
	         
		filterName = name;
		Iterator iter = params.entrySet().iterator();
		while ( iter.hasNext() ) {
			Map.Entry me = (Map.Entry) iter.next();
			Type type = (Type) types.get( me.getKey() );
			filterParameters.put( me.getKey(), new TypedValue( type, me.getValue(), entityMode ) );
		}
	
Methods Summary
public static java.util.SetcreateFilterKeys(java.util.Map enabledFilters, org.hibernate.EntityMode entityMode)

		if ( enabledFilters.size()==0 ) return null;
		Set result = new HashSet();
		Iterator iter = enabledFilters.values().iterator();
		while ( iter.hasNext() ) {
			FilterImpl filter = (FilterImpl) iter.next();
			FilterKey key = new FilterKey(
					filter.getName(), 
					filter.getParameters(), 
					filter.getFilterDefinition().getParameterTypes(), 
					entityMode
				);
			result.add(key);
		}
		return result;
	
public booleanequals(java.lang.Object other)

		if ( !(other instanceof FilterKey) ) return false;
		FilterKey that = (FilterKey) other;
		if ( !that.filterName.equals(filterName) ) return false;
		if ( !that.filterParameters.equals(filterParameters) ) return false;
		return true;
	
public inthashCode()

		int result = 13;
		result = 37 * result + filterName.hashCode();
		result = 37 * result + filterParameters.hashCode();
		return result;
	
public java.lang.StringtoString()

		return "FilterKey[" + filterName + filterParameters + ']";