// Path: src/main/java/org/springframework/data/hazelcast/repository/support/HazelcastRepositoryFactory.java
// public class HazelcastRepositoryFactory
//         extends KeyValueRepositoryFactory {
// 
//     private static final Class<SpelQueryCreator> DEFAULT_QUERY_CREATOR = SpelQueryCreator.class;
// 
//     private final KeyValueOperations keyValueOperations;
//     private final Class<? extends AbstractQueryCreator<?, ?>> queryCreator;
//     private final HazelcastInstance hazelcastInstance;
// 
//     /* Mirror functionality of super, to ensure private
//      * fields are set.
//      */
//     public HazelcastRepositoryFactory(KeyValueOperations keyValueOperations, HazelcastInstance hazelcastInstance) {
//         this(keyValueOperations, DEFAULT_QUERY_CREATOR, hazelcastInstance);
//     }
// 
//     /* Capture KeyValueOperations and QueryCreator objects after passing to super.
//      */
//     public HazelcastRepositoryFactory(KeyValueOperations keyValueOperations,
//                                       Class<? extends AbstractQueryCreator<?, ?>> queryCreator,
//                                       HazelcastInstance hazelcastInstance) {
// 
//         super(keyValueOperations, queryCreator);
// 
//         this.keyValueOperations = keyValueOperations;
//         this.queryCreator = queryCreator;
//         this.hazelcastInstance = hazelcastInstance;
//     }
// 
//     /**
//      * <p>
//      * Ensure the mechanism for query evaluation is Hazelcast specific, as the original
//      * {@link KeyValueRepositoryFactory.KeyValueQueryLookupStrategy} does not function correctly for Hazelcast.
//      * </P>
//      */
//     @Override
//     protected Optional<QueryLookupStrategy> getQueryLookupStrategy(QueryLookupStrategy.Key key,
//                                                             QueryMethodEvaluationContextProvider evaluationContextProvider) {
//         return Optional.of(new HazelcastQueryLookupStrategy(key, evaluationContextProvider, keyValueOperations, queryCreator,
//                 hazelcastInstance));
//     }
// 
//     @Override
//     public <T, ID> EntityInformation<T, ID> getEntityInformation(Class<T> domainClass) {
//         PersistentEntity<T, ?> entity = (PersistentEntity<T, ?>) keyValueOperations.getMappingContext()
//                                                                                    .getPersistentEntity(domainClass);
//         Assert.notNull(entity, "Entity must not be 'null'.");
//         return new HazelcastEntityInformation<>(entity);
//     }
// }


import com.hazelcast.core.HazelcastInstance;
import org.springframework.data.hazelcast.repository.support.HazelcastRepositoryFactory;
import org.springframework.data.keyvalue.core.KeyValueOperations;
import org.springframework.data.repository.core.EntityInformation;
import org.springframework.data.repository.core.RepositoryInformation;
import org.springframework.data.repository.core.RepositoryMetadata;
import org.springframework.data.repository.query.parser.AbstractQueryCreator;
import java.io.Serializable;
/*
 * Copyright (c) 2008-2018, Hazelcast, Inc. All Rights Reserved.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package test.utils.repository.custom;



/**
 * <P>Factory for creating instances of {@link MyTitleRepository},
 * being {@link MovieRepository} and {@link SongRepository}.
 * </P>
 *
 * @author Neil Stevenson
 */
public class MyTitleRepositoryFactory
        extends HazelcastRepositoryFactory {

    private KeyValueOperations keyValueOperations;

    /* Delegate creation to super, but capture the KeyValueOperations
     * object for later use.
     */
    public MyTitleRepositoryFactory(KeyValueOperations keyValueOperations,
                                    Class<? extends AbstractQueryCreator<?, ?>> queryCreator,
                                    HazelcastInstance hazelcastInstance) {
        super(keyValueOperations, queryCreator, hazelcastInstance);
        this.keyValueOperations = keyValueOperations;
    }

    /* Create an implementation using captured KeyValueOperations
     * and the domain class metadata.
     *
     * (non-Javadoc)
     * @see org.springframework.data.keyvalue.repository.support.KeyValueRepositoryFactory#getTargetRepository(org
     * .springframework.data.repository.core.RepositoryInformation)
     */
// Path: src/main/java/org/springframework/data/hazelcast/repository/support/HazelcastRepositoryFactory.java
// public class HazelcastRepositoryFactory
//         extends KeyValueRepositoryFactory {
// 
//     private static final Class<SpelQueryCreator> DEFAULT_QUERY_CREATOR = SpelQueryCreator.class;
// 
//     private final KeyValueOperations keyValueOperations;
//     private final Class<? extends AbstractQueryCreator<?, ?>> queryCreator;
//     private final HazelcastInstance hazelcastInstance;
// 
//     /* Mirror functionality of super, to ensure private
//      * fields are set.
//      */
//     public HazelcastRepositoryFactory(KeyValueOperations keyValueOperations, HazelcastInstance hazelcastInstance) {
//         this(keyValueOperations, DEFAULT_QUERY_CREATOR, hazelcastInstance);
//     }
// 
//     /* Capture KeyValueOperations and QueryCreator objects after passing to super.
//      */
//     public HazelcastRepositoryFactory(KeyValueOperations keyValueOperations,
//                                       Class<? extends AbstractQueryCreator<?, ?>> queryCreator,
//                                       HazelcastInstance hazelcastInstance) {
// 
//         super(keyValueOperations, queryCreator);
// 
//         this.keyValueOperations = keyValueOperations;
//         this.queryCreator = queryCreator;
//         this.hazelcastInstance = hazelcastInstance;
//     }
// 
//     /**
//      * <p>
//      * Ensure the mechanism for query evaluation is Hazelcast specific, as the original
//      * {@link KeyValueRepositoryFactory.KeyValueQueryLookupStrategy} does not function correctly for Hazelcast.
//      * </P>
//      */
//     @Override
//     protected Optional<QueryLookupStrategy> getQueryLookupStrategy(QueryLookupStrategy.Key key,
//                                                             QueryMethodEvaluationContextProvider evaluationContextProvider) {
//         return Optional.of(new HazelcastQueryLookupStrategy(key, evaluationContextProvider, keyValueOperations, queryCreator,
//                 hazelcastInstance));
//     }
// 
//     @Override
//     public <T, ID> EntityInformation<T, ID> getEntityInformation(Class<T> domainClass) {
//         PersistentEntity<T, ?> entity = (PersistentEntity<T, ?>) keyValueOperations.getMappingContext()
//                                                                                    .getPersistentEntity(domainClass);
//         Assert.notNull(entity, "Entity must not be 'null'.");
//         return new HazelcastEntityInformation<>(entity);
//     }
// }


// Path: src/test/java/test/utils/repository/custom/MyTitleRepositoryFactory.java
import com.hazelcast.core.HazelcastInstance;
import org.springframework.data.hazelcast.repository.support.HazelcastRepositoryFactory;
import org.springframework.data.keyvalue.core.KeyValueOperations;
import org.springframework.data.repository.core.EntityInformation;
import org.springframework.data.repository.core.RepositoryInformation;
import org.springframework.data.repository.core.RepositoryMetadata;
import org.springframework.data.repository.query.parser.AbstractQueryCreator;
import java.io.Serializable;

/*
 * Copyright (c) 2008-2018, Hazelcast, Inc. All Rights Reserved.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package test.utils.repository.custom;



/**
 * <P>Factory for creating instances of {@link MyTitleRepository},
 * being {@link MovieRepository} and {@link SongRepository}.
 * </P>
 *
 * @author Neil Stevenson
 */
public class MyTitleRepositoryFactory
        extends HazelcastRepositoryFactory {

    private KeyValueOperations keyValueOperations;

    /* Delegate creation to super, but capture the KeyValueOperations
     * object for later use.
     */
    public MyTitleRepositoryFactory(KeyValueOperations keyValueOperations,
                                    Class<? extends AbstractQueryCreator<?, ?>> queryCreator,
                                    HazelcastInstance hazelcastInstance) {
        super(keyValueOperations, queryCreator, hazelcastInstance);
        this.keyValueOperations = keyValueOperations;
    }

    /* Create an implementation using captured KeyValueOperations
     * and the domain class metadata.
     *
     * (non-Javadoc)
     * @see org.springframework.data.keyvalue.repository.support.KeyValueRepositoryFactory#getTargetRepository(org
     * .springframework.data.repository.core.RepositoryInformation)
     */
    @SuppressWarnings({"unchecked", "rawtypes"})