// Path: src/main/java/org/springframework/data/hazelcast/repository/support/SimpleHazelcastRepository.java
// public class SimpleHazelcastRepository<T extends Serializable, ID extends Serializable>
//         extends SimpleKeyValueRepository<T, ID>
//         implements HazelcastRepository<T, ID> {
// 
//     public SimpleHazelcastRepository(EntityInformation<T, ID> metadata, KeyValueOperations operations) {
//         super(metadata, operations);
//     }
// 
// }
// 
// Path: src/test/java/test/utils/domain/MyTitle.java
// public abstract class MyTitle
//         implements Comparable<MyTitle>, Serializable {
//     private static final long serialVersionUID = 1L;
// 
//     @Id
//     private String id;
//     private String title;
// 
//     public String getId() {
//         return id;
//     }
// 
//     public void setId(String id) {
//         this.id = id;
//     }
// 
//     public String getTitle() {
//         return title;
//     }
// 
//     public void setTitle(String title) {
//         this.title = title;
//     }
// 
//     @Override
//     public int hashCode() {
//         final int prime = 31;
//         int result = 1;
//         result = prime * result + ((id == null) ? 0 : id.hashCode());
//         result = prime * result + ((title == null) ? 0 : title.hashCode());
//         return result;
//     }
// 
//     @Override
//     public boolean equals(Object obj) {
//         if (this == obj) {
//             return true;
//         }
//         if (obj == null) {
//             return false;
//         }
//         if (getClass() != obj.getClass()) {
//             return false;
//         }
//         MyTitle other = (MyTitle) obj;
//         if (id == null) {
//             if (other.id != null) {
//                 return false;
//             }
//         } else if (!id.equals(other.id)) {
//             return false;
//         }
//         if (title == null) {
//             if (other.title != null) {
//                 return false;
//             }
//         } else if (!title.equals(other.title)) {
//             return false;
//         }
//         return true;
//     }
// 
//     // Sort by title only
//     @Override
//     public int compareTo(MyTitle that) {
//         return this.title.compareTo(that.getTitle());
//     }
// 
// }


import org.springframework.data.hazelcast.repository.support.SimpleHazelcastRepository;
import org.springframework.data.keyvalue.core.KeyValueOperations;
import org.springframework.data.repository.core.EntityInformation;
import test.utils.domain.MyTitle;
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>Implement a custom repository for {@link MyTitleRepository}, but
 * inherit most of the behaviour from {@link SimpleHazelcastRepository}.
 * </P>
 *
 * @param <T>  The domain object
 * @param <ID> The key of the domain object
 * @author Neil Stevenson
 */
public class MyTitleRepositoryImpl<T extends Serializable, ID extends Serializable>
        extends SimpleHazelcastRepository<T, ID>
        implements MyTitleRepository<T, ID> {

    public MyTitleRepositoryImpl(EntityInformation<T, ID> metadata, KeyValueOperations keyValueOperations) {
        super(metadata, keyValueOperations);
    }

    /**
     * <p>
     * Count the words in a particular title.
     * </P>
     *
     * @param Key to lookup
     * @return Tokens in string, -1 if not found
     */
    public int wordsInTitle(String year) {
// Path: src/main/java/org/springframework/data/hazelcast/repository/support/SimpleHazelcastRepository.java
// public class SimpleHazelcastRepository<T extends Serializable, ID extends Serializable>
//         extends SimpleKeyValueRepository<T, ID>
//         implements HazelcastRepository<T, ID> {
// 
//     public SimpleHazelcastRepository(EntityInformation<T, ID> metadata, KeyValueOperations operations) {
//         super(metadata, operations);
//     }
// 
// }
// 
// Path: src/test/java/test/utils/domain/MyTitle.java
// public abstract class MyTitle
//         implements Comparable<MyTitle>, Serializable {
//     private static final long serialVersionUID = 1L;
// 
//     @Id
//     private String id;
//     private String title;
// 
//     public String getId() {
//         return id;
//     }
// 
//     public void setId(String id) {
//         this.id = id;
//     }
// 
//     public String getTitle() {
//         return title;
//     }
// 
//     public void setTitle(String title) {
//         this.title = title;
//     }
// 
//     @Override
//     public int hashCode() {
//         final int prime = 31;
//         int result = 1;
//         result = prime * result + ((id == null) ? 0 : id.hashCode());
//         result = prime * result + ((title == null) ? 0 : title.hashCode());
//         return result;
//     }
// 
//     @Override
//     public boolean equals(Object obj) {
//         if (this == obj) {
//             return true;
//         }
//         if (obj == null) {
//             return false;
//         }
//         if (getClass() != obj.getClass()) {
//             return false;
//         }
//         MyTitle other = (MyTitle) obj;
//         if (id == null) {
//             if (other.id != null) {
//                 return false;
//             }
//         } else if (!id.equals(other.id)) {
//             return false;
//         }
//         if (title == null) {
//             if (other.title != null) {
//                 return false;
//             }
//         } else if (!title.equals(other.title)) {
//             return false;
//         }
//         return true;
//     }
// 
//     // Sort by title only
//     @Override
//     public int compareTo(MyTitle that) {
//         return this.title.compareTo(that.getTitle());
//     }
// 
// }


// Path: src/test/java/test/utils/repository/custom/MyTitleRepositoryImpl.java
import org.springframework.data.hazelcast.repository.support.SimpleHazelcastRepository;
import org.springframework.data.keyvalue.core.KeyValueOperations;
import org.springframework.data.repository.core.EntityInformation;
import test.utils.domain.MyTitle;
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>Implement a custom repository for {@link MyTitleRepository}, but
 * inherit most of the behaviour from {@link SimpleHazelcastRepository}.
 * </P>
 *
 * @param <T>  The domain object
 * @param <ID> The key of the domain object
 * @author Neil Stevenson
 */
public class MyTitleRepositoryImpl<T extends Serializable, ID extends Serializable>
        extends SimpleHazelcastRepository<T, ID>
        implements MyTitleRepository<T, ID> {

    public MyTitleRepositoryImpl(EntityInformation<T, ID> metadata, KeyValueOperations keyValueOperations) {
        super(metadata, keyValueOperations);
    }

    /**
     * <p>
     * Count the words in a particular title.
     * </P>
     *
     * @param Key to lookup
     * @return Tokens in string, -1 if not found
     */
    public int wordsInTitle(String year) {
        @SuppressWarnings("unchecked") MyTitle myTitle = (MyTitle) super.findById((ID) year).orElse(null);