yoyo.framework.enterprise.domain.ConstraintsException.java Source code

Java tutorial

Introduction

Here is the source code for yoyo.framework.enterprise.domain.ConstraintsException.java

Source

// ========================================================================
// Copyright (C) YOYO Project Team. All rights reserved.
// GNU AFFERO GENERAL PUBLIC LICENSE Version 3, 19 November 2007
// http://www.gnu.org/licenses/agpl-3.0.txt
// ========================================================================
package yoyo.framework.enterprise.domain;

import java.util.Map;
import java.util.Map.Entry;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.text.StrBuilder;
import yoyo.framework.enterprise.shared.EnterpriseBundle;
import yoyo.framework.enterprise.shared.EnterpriseException;
import yoyo.framework.standard.shared.StandardException;

/**
 * ????
 * @author nilcy
 */
public class ConstraintsException extends EnterpriseException {
    /** ? */
    private static final long serialVersionUID = 616063210164554646L;

    /**
     * 
     * @param key 
     * @param values ??
     * @see StandardException#StandardException(String, Object...)
     */
    public ConstraintsException(final String key, final Object... values) {
        super(key, values);
    }

    /**
     * 
     * @param causeMap {@link EnterpriseException#getCauseMap()}
     */
    public ConstraintsException(final Map<String, Object[]> causeMap) {
        super(causeMap);
    }

    /** {@inheritDoc} */
    @Override
    public String getLocalizedMessage() {
        final Map<String, Object[]> causeMap = getCauseMap();
        final StrBuilder builder = new StrBuilder();
        for (final Entry<String, Object[]> entry : causeMap.entrySet()) {
            builder.appendln(EnterpriseBundle.formatMessage(entry.getKey(), entry.getValue()));
        }
        return StringUtils.chop(builder.toString());
    }
}