All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.sap.cloud.yaas.servicesdk.auditbase.validation.ValidationViolation Maven / Gradle / Ivy

The newest version!
/*
 * © 2017 SAP SE or an SAP affiliate company.
 * All rights reserved.
 * Please see http://www.sap.com/corporate-en/legal/copyright/index.epx for additional trademark information and
 * notices.
 */
package com.sap.cloud.yaas.servicesdk.auditbase.validation;

import java.io.Serializable;

/**
 * Holds information about a single validation error.
 */
public class ValidationViolation implements Serializable
{
	private static final long serialVersionUID = -8923496434594896167L;

	private final String field;
	private final String message;

	/**
	 * Creates a new instance of {@link ValidationViolation}.
	 *
	 * @param field the invalid field
	 * @param validationMessage the explanation why it is not valid
	 */
	public ValidationViolation(final String field, final String validationMessage)
	{
		this.field = field;
		this.message = validationMessage;
	}

	/**
	 * Returns the field that is invalid.
	 *
	 * @return the name of the invalid field
	 */
	public String getField()
	{
		return field;
	}

	/**
	 * Returns the validation error explanation.
	 *
	 * @return the validation error message
	 */
	public String getMessage()
	{
		return message;
	}

	@Override
	public String toString()
	{
		return String.format("'%s': '%s'", field, message);
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy