return instance;
}
private FilterKey createFilterKey(FilterDef def, Object instance) {
FilterKey key = null;
if (!cacheInstance(def.getCacheMode())) {
return key; // if the filter is not cached there is no key!
}
if (def.getKeyMethod() == null) {
key = new FilterKey() {
public int hashCode() {
return getImpl().hashCode();
}
public boolean equals(Object obj) {
if (!(obj instanceof FilterKey)) {
return false;
}
FilterKey that = (FilterKey) obj;
return this.getImpl().equals(that.getImpl());
}
};
} else {
try {
key = (FilterKey) def.getKeyMethod().invoke(instance);