Refactored value object to entity, definition was backwards

This commit is contained in:
Kenny Bastani
2016-12-31 05:05:49 -05:00
parent be991ee79c
commit 2b8fd79fce
4 changed files with 9 additions and 10 deletions

View File

@@ -1,15 +1,14 @@
package demo.order;
import com.fasterxml.jackson.annotation.JsonIgnore;
import demo.domain.Value;
import demo.domain.Entity;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
@Entity
public class LineItem implements Value<Long> {
@javax.persistence.Entity
public class LineItem implements Entity<Long> {
@Id
@GeneratedValue(strategy = GenerationType.AUTO)

View File

@@ -21,14 +21,14 @@ import java.util.stream.Collectors;
import static org.springframework.hateoas.mvc.ControllerLinkBuilder.linkTo;
/**
* An {@link Aggregate} is an entity that contains references to one or more other {@link Value} objects. Aggregates
* An {@link Aggregate} is an entity that contains references to one or more other {@link Entity} objects. Aggregates
* may contain a collection of references to a {@link Command}. All command references on an aggregate should be
* explicitly typed.
*
* @author Kenny Bastani
*/
public abstract class Aggregate<E extends Event, ID extends Serializable> extends ResourceSupport implements
Value<Link> {
Entity<Link> {
@JsonProperty("id")
public abstract ID getIdentity();

View File

@@ -1,7 +1,7 @@
package demo.domain;
/**
* A {@link Commodity} object is a {@link Value} object that is also an {@link Aggregate} root. A commodity object
* A {@link Commodity} object is a {@link Entity} object that is also an {@link Aggregate} root. A commodity object
* describes all aspects of an aggregate and is both stateless and immutable. A commodity is a locator that connects
* relationships of a value object to a {@link Provider}.
* <p>

View File

@@ -6,11 +6,11 @@ import org.springframework.hateoas.Identifiable;
import java.io.Serializable;
/**
* {@link Value} objects are wrappers that contain the serializable properties that uniquely identify an entity.
* Value objects contain a collection of relationships. Value objects contain a collection of comparison operators.
* {@link Entity} objects are wrappers that contain the serializable properties that uniquely identify an entity.
* Entities contain a collection of relationships. Entities contain a collection of comparison operators.
* The default identity comparator evaluates true if the compared objects have the same identifier.
*
* @author Kenny Bastani
*/
public interface Value<ID extends Serializable> extends Identifiable<ID> {
public interface Entity<ID extends Serializable> extends Identifiable<ID> {
}