# BeanValidationException

Import: `import com.install4j.api.beaninfo.BeanValidationException;`

```java
public class BeanValidationException extends Exception
```

Exception for notifying the user that a property value of a bean is not valid.
Throw this exception in implementations of [`BeanValidator.validateBean`](BeanValidator.md#validatebean-bean).
The user will be notified with a message constructed from the supplied information.

## Methods

| Signature | Returns | Description |
|---|---|---|
| [`getPropertyName()`](#getpropertyname) | `String` | Get the name of the invalid property, or `null` if no property name was specified in the constructor. |
| [`setCustomizerTabName(String)`](#setcustomizertabname-string) | `void` | Set the name of the customizer tab if the error message applies to a customizer. |
| [`getCustomizerTabName()`](#getcustomizertabname) | `String` | Get the name of the customizer tab that was set with `setCustomizerTabName`. |

### getPropertyName()

```java
public String getPropertyName()
```

Get the name of the invalid property, or `null` if no property name was specified in the constructor.


**Returns:** the property name

### setCustomizerTabName(String)

```java
public void setCustomizerTabName(String customizerTabName)
```

Set the name of the customizer tab if the error message applies to a customizer. This is either the
`name` property of the `javax.swing.JComponent` or, if the customizer is a
`javax.swing.JTabbedPane`, the name of the tab.


**Parameters:**

- `customizerTabName` — the name

**See also:**

- [Install4JBeanInfo.Install4JBeanInfo](Install4JBeanInfo.md#install4jbeaninfo-string-string-string-boolean-boolean-integer-class-extends-bean-class)

### getCustomizerTabName()

```java
public String getCustomizerTabName()
```

Get the name of the customizer tab that was set with `setCustomizerTabName`.


**Returns:** the name

**See also:**

- [BeanValidationException.setCustomizerTabName](BeanValidationException.md#setcustomizertabname-string)

## Constructors

| Signature | Description |
|---|---|
| [`BeanValidationException(String)`](#beanvalidationexception-string) | Constructor with an error message. |
| [`BeanValidationException(String, String)`](#beanvalidationexception-string-string) | Constructor with an error message and a property name. |

### BeanValidationException(String)

```java
public BeanValidationException(String errorMessage)
```

Constructor with an error message.


**Parameters:**

- `errorMessage` — the error message

### BeanValidationException(String, String)

```java
public BeanValidationException(String errorMessage, String propertyName)
```

Constructor with an error message and a property name.
The specified property will be selected in the install4j GUI.


**Parameters:**

- `errorMessage` — the error message
- `propertyName` — the name of the invalid property

