Example usage for org.apache.commons.lang.builder HashCodeBuilder toString

List of usage examples for org.apache.commons.lang.builder HashCodeBuilder toString

Introduction

In this page you can find the example usage for org.apache.commons.lang.builder HashCodeBuilder toString.

Prototype

public String toString() 

Source Link

Document

Returns a string representation of the object.

Usage

From source file:com.dp2345.entity.Cart.java

/**
 * ?//from w  ww  . ja va  2s .  c  o m
 * 
 * @return 
 */
@Transient
public String getToken() {
    HashCodeBuilder hashCodeBuilder = new HashCodeBuilder(17, 37).append(getKey());
    if (getCartItems() != null) {
        for (CartItem cartItem : getCartItems()) {
            hashCodeBuilder.append(cartItem.getProduct()).append(cartItem.getQuantity())
                    .append(cartItem.getPrice());
        }
    }
    return DigestUtils.md5Hex(hashCodeBuilder.toString());
}