Java tutorial
/* * Copyright 2005-2013 iterzp.com. All rights reserved. * Support: http://www.iterzp.com * License: http://www.iterzp.com/license */ package com.iterzp.momo.entity; import javax.persistence.Column; import javax.persistence.MappedSuperclass; import javax.validation.constraints.Min; import org.apache.commons.lang.builder.CompareToBuilder; import org.codehaus.jackson.annotate.JsonProperty; import org.hibernate.search.annotations.Field; import org.hibernate.search.annotations.Index; import org.hibernate.search.annotations.Store; /** * Entity - ? * * @author yd14 Team * @version 3.0 */ @MappedSuperclass public abstract class OrderEntity extends BaseEntity implements Comparable<OrderEntity> { private static final long serialVersionUID = 5995013015967525827L; /** "?"?? */ public static final String ORDER_PROPERTY_NAME = "order"; /** ? */ private Integer order; public OrderEntity(Long id) { super(id); } public OrderEntity() { super(); } /** * ?? * * @return ? */ @JsonProperty @Field(store = Store.YES, index = Index.UN_TOKENIZED) @Min(0) @Column(name = "orders") public Integer getOrder() { return order; } /** * ? * * @param order * ? */ public void setOrder(Integer order) { this.order = order; } /** * compareTo * * @param orderEntity * ? * @return */ @Override public int compareTo(OrderEntity orderEntity) { return new CompareToBuilder().append(getOrder(), orderEntity.getOrder()) .append(getId(), orderEntity.getId()).toComparison(); } }