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

org.hibernate.validator.InvalidValue Maven / Gradle / Ivy

There is a newer version: 3.5.6-Final
Show newest version
//$Id: InvalidValue.java 8584 2005-11-15 19:47:38Z epbernard $
package org.hibernate.validator;

import java.io.Serializable;

/**
 * A single violation of a class level or method level constraint.
 *
 * @author Gavin King
 */
public class InvalidValue implements Serializable {
	private final String message;
	private final Object value;
	private final String propertyName;
	private final Class beanClass;
	private final Object bean;
	private Object rootBean;

	public Object getRootBean() {
		return rootBean;
	}

	public String getPropertyPath() {
		return propertyPath;
	}

	private String propertyPath;

	public InvalidValue(String message, Class beanClass, String propertyName, Object value, Object bean) {
		this.message = message;
		this.value = value;
		this.beanClass = beanClass;
		this.propertyName = propertyName;
		this.bean = bean;
		this.rootBean = bean;
		this.propertyPath = propertyName;
	}

	public void addParentBean(Object parentBean, String propertyName) {
		this.rootBean = parentBean;
		this.propertyPath = propertyName + "." + this.propertyPath;
	}

	public Class getBeanClass() {
		return beanClass;
	}

	public String getMessage() {
		return message;
	}

	public String getPropertyName() {
		return propertyName;
	}

	public Object getValue() {
		return value;
	}

	public Object getBean() {
		return bean;
	}

	public String toString() {
		return propertyName + ' ' + message;
	}

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy