Created a Spring Data GemFire Starter POM

... as well as a Spring Boot Sample Application with associated tests
for demonstrating how to get started using both Spring Data GemFire
and GemFire.
This commit is contained in:
John Blum
2014-03-28 22:47:56 -07:00
committed by Dave Syer
parent 898698a681
commit 34cbe1e60b
15 changed files with 698 additions and 2 deletions

View File

@@ -0,0 +1,99 @@
/*
* Copyright 2010-2013 the original author or authors.
*
* 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 sample.data.gemfire.domain;
import java.io.Serializable;
import org.springframework.data.annotation.Id;
import org.springframework.data.gemfire.mapping.Region;
import org.springframework.util.ObjectUtils;
/**
* The Gemstone class is an abstract data type modeling a Gemstone, such as a diamond or a ruby.
* <p/>
* @author John Blum
* @see java.io.Serializable
* @see org.springframework.data.annotation.Id
* @see org.springframework.data.gemfire.mapping.Region
* @since 1.0.0
*/
@Region("Gemstones")
@SuppressWarnings("unused")
public class Gemstone implements Serializable {
@Id
private Long id;
private String name;
public Gemstone() {
}
public Gemstone(final Long id) {
this.id = id;
}
public Gemstone(final Long id, final String name) {
this.id = id;
this.name = name;
}
public Long getId() {
return id;
}
public void setId(final Long id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(final String name) {
this.name = name;
}
@Override
public boolean equals(final Object obj) {
if (obj == this) {
return true;
}
if (!(obj instanceof Gemstone)) {
return false;
}
Gemstone that = (Gemstone) obj;
return ObjectUtils.nullSafeEquals(this.getName(), that.getName());
}
@Override
public int hashCode() {
int hashValue = 17;
hashValue = 37 * hashValue + ObjectUtils.nullSafeHashCode(getName());
return hashValue;
}
@Override
public String toString() {
return String.format("{ @type = %1$s, id = %2$d, name = %3$s }",
getClass().getName(), getId(), getName());
}
}