com.zb.app.common.core.CustomToStringStyle.java Source code

Java tutorial

Introduction

Here is the source code for com.zb.app.common.core.CustomToStringStyle.java

Source

/*
 * Copyright 2011-2016 ZuoBian.com All right reserved. This software is the confidential and proprietary information of
 * ZuoBian.com ("Confidential Information"). You shall not disclose such Confidential Information and shall use it only
 * in accordance with the terms of the license agreement you entered into with ZuoBian.com.
 */
package com.zb.app.common.core;

import java.text.SimpleDateFormat;
import java.util.Date;

import org.apache.commons.lang.builder.ToStringStyle;

/**
 * toStringStyle
 * 
 * @author zxc Jul 1, 2014 12:18:08 PM
 */
public class CustomToStringStyle extends ToStringStyle {

    private static final long serialVersionUID = -2609851797407312977L;;

    protected void appendDetail(StringBuffer buffer, String fieldName, Object value) {
        if (value instanceof Date) {
            value = new SimpleDateFormat("yyyy-MM-dd").format(value);
        }
        buffer.append(value);
    }
}