| 1 |
|
package org.trails.validation; |
| 2 |
|
|
| 3 |
|
import java.text.MessageFormat; |
| 4 |
|
|
| 5 |
|
import org.trails.descriptor.IPropertyDescriptor; |
| 6 |
|
import org.trails.persistence.PersistenceException; |
| 7 |
|
|
| 8 |
|
public class ValidationException extends PersistenceException |
| 9 |
|
{ |
| 10 |
|
|
| 11 |
|
public static final String DEFAULT_MESSAGE = "{0} must be unique."; |
| 12 |
|
private String message; |
| 13 |
|
|
| 14 |
|
public ValidationException(IPropertyDescriptor descriptor) |
| 15 |
|
{ |
| 16 |
0 |
this(descriptor, DEFAULT_MESSAGE); |
| 17 |
0 |
} |
| 18 |
|
|
| 19 |
|
public ValidationException(IPropertyDescriptor descriptor, String message) |
| 20 |
|
{ |
| 21 |
0 |
this(MessageFormat.format(message, descriptor.getDisplayName())); |
| 22 |
0 |
} |
| 23 |
|
|
| 24 |
|
public ValidationException() |
| 25 |
|
{ |
| 26 |
0 |
super(); |
| 27 |
|
|
| 28 |
0 |
} |
| 29 |
|
|
| 30 |
|
public ValidationException(String message) |
| 31 |
|
{ |
| 32 |
4 |
super(message); |
| 33 |
|
|
| 34 |
4 |
} |
| 35 |
|
|
| 36 |
|
public ValidationException(String message, Throwable cause) |
| 37 |
|
{ |
| 38 |
0 |
super(message, cause); |
| 39 |
|
|
| 40 |
0 |
} |
| 41 |
|
|
| 42 |
|
public ValidationException(Throwable cause) |
| 43 |
|
{ |
| 44 |
0 |
super(cause); |
| 45 |
|
|
| 46 |
0 |
} |
| 47 |
|
|
| 48 |
|
} |