// Path: src/main/java/org/mockenize/vendor/hazelcast/predicate/PathPredicate.java
// public class PathPredicate implements Predicate<String, Object> {
// 
// 	private static final long serialVersionUID = 4605050326503577349L;
// 	private final String value;
// 
//     public PathPredicate(String value) {
//         this.value = value.replaceAll("/", "_");
//     }
// 
//     public PathPredicate(String... segments) {
//         StringBuilder stringBuilder = new StringBuilder();
//         for (String segment : segments) {
//             stringBuilder.append(segment);
//         }
//         this.value = stringBuilder.toString().replaceAll("/", "_");
//     }
// 
//     @Override
//     public boolean apply(Map.Entry<String, Object> mapEntry) {
//         return value.matches(mapEntry.getKey().replace("*", "[^/]+"));
//     }
// }


import java.util.Collection;
import java.util.Iterator;
import java.util.Set;
import org.mockenize.vendor.hazelcast.predicate.PathPredicate;
import com.google.common.base.Function;
import com.google.common.collect.Collections2;
import com.hazelcast.core.HazelcastInstance;
import com.hazelcast.core.IMap;
import com.hazelcast.query.Predicate;
package org.mockenize.repository;




public abstract class AbstractRepository<T extends Cacheable> {

	protected final IMap<String, T> map;

	public AbstractRepository(HazelcastInstance hazelcastInstance, String mapKey) {
		this.map = hazelcastInstance.getMap(mapKey);
		map.addIndex("key", Boolean.TRUE);
	}

	public T findByKey(String key) {
// Path: src/main/java/org/mockenize/vendor/hazelcast/predicate/PathPredicate.java
// public class PathPredicate implements Predicate<String, Object> {
// 
// 	private static final long serialVersionUID = 4605050326503577349L;
// 	private final String value;
// 
//     public PathPredicate(String value) {
//         this.value = value.replaceAll("/", "_");
//     }
// 
//     public PathPredicate(String... segments) {
//         StringBuilder stringBuilder = new StringBuilder();
//         for (String segment : segments) {
//             stringBuilder.append(segment);
//         }
//         this.value = stringBuilder.toString().replaceAll("/", "_");
//     }
// 
//     @Override
//     public boolean apply(Map.Entry<String, Object> mapEntry) {
//         return value.matches(mapEntry.getKey().replace("*", "[^/]+"));
//     }
// }


// Path: src/main/java/org/mockenize/repository/AbstractRepository.java
import java.util.Collection;
import java.util.Iterator;
import java.util.Set;
import org.mockenize.vendor.hazelcast.predicate.PathPredicate;
import com.google.common.base.Function;
import com.google.common.collect.Collections2;
import com.hazelcast.core.HazelcastInstance;
import com.hazelcast.core.IMap;
import com.hazelcast.query.Predicate;

package org.mockenize.repository;




public abstract class AbstractRepository<T extends Cacheable> {

	protected final IMap<String, T> map;

	public AbstractRepository(HazelcastInstance hazelcastInstance, String mapKey) {
		this.map = hazelcastInstance.getMap(mapKey);
		map.addIndex("key", Boolean.TRUE);
	}

	public T findByKey(String key) {
		Set<String> keys = map.keySet(new PathPredicate(key));