acromusashi.stream.trace.KeyHistory.java Source code

Java tutorial

Introduction

Here is the source code for acromusashi.stream.trace.KeyHistory.java

Source

/**
* Copyright (c) Acroquest Technology Co, Ltd. All Rights Reserved.
* Please read the associated COPYRIGHTS file for more details.
*
* THE SOFTWARE IS PROVIDED BY Acroquest Technolog Co., Ltd.,
* WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
* BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDER BE LIABLE FOR ANY
* CLAIM, DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING
* OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES.
*/
package acromusashi.stream.trace;

import java.io.Serializable;
import java.text.MessageFormat;
import java.util.LinkedHashSet;
import java.util.Set;

import org.apache.commons.lang.SerializationUtils;

/**
 * ????ValueObject
 *
 * @author kimura
 */
public class KeyHistory implements Serializable {
    /** serialVersionUID */
    private static final long serialVersionUID = -7488577569585048930L;

    /** ?? */
    private static final String TOSTRING_FORMAT = "KeyHistory={0}";

    /** ??????????????Set???*/
    protected Set<String> keyHistory = new LinkedHashSet<>();

    /**
     * ?????
     */
    public KeyHistory() {
        // Do nothing.
    }

    /**
     * ????<br>
     * ???????????????????
     *
     * @param messageKey 
     */
    public void addKey(String messageKey) {
        this.keyHistory.add(messageKey);
    }

    /**
     * KeyHistoryInfo?????
     *
     * @return KeyHistoryInfo?
     */
    public KeyHistory createDeepCopy() {
        KeyHistory result = (KeyHistory) SerializationUtils.clone(this);
        return result;
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public String toString() {
        String keyHistoryStr = this.keyHistory.toString();
        String result = MessageFormat.format(TOSTRING_FORMAT, keyHistoryStr);
        return result;
    }
}