1
|
package eu.dnetlib.clients.index.model;
|
2
|
|
3
|
/**
|
4
|
* A runtime exception that will be thrown if the value types of the Any objects do not match the expected types.
|
5
|
*/
|
6
|
public class InvalidValueTypeException extends RuntimeException {
|
7
|
|
8
|
/**
|
9
|
* exceptions can be serialized.
|
10
|
*/
|
11
|
private static final long serialVersionUID = 1L;
|
12
|
|
13
|
/**
|
14
|
* unsupported value type that caused this exception.
|
15
|
*/
|
16
|
private final Class<?> _unsupportedType;
|
17
|
|
18
|
/**
|
19
|
* Creates an InvalidValueTypeException with the given message.
|
20
|
*
|
21
|
* @param message The message for the user.
|
22
|
*/
|
23
|
public InvalidValueTypeException(final String message) {
|
24
|
this(message, (Class<?>) null);
|
25
|
}
|
26
|
|
27
|
/**
|
28
|
* Instantiates a new invalid value type exception.
|
29
|
*
|
30
|
* @param message the message
|
31
|
* @param unsupportedType the unsupported type
|
32
|
*/
|
33
|
public InvalidValueTypeException(final String message, final Class<?> unsupportedType) {
|
34
|
super(message);
|
35
|
_unsupportedType = unsupportedType;
|
36
|
}
|
37
|
|
38
|
/**
|
39
|
* Instantiates a new invalid value type exception.
|
40
|
*
|
41
|
* @param unsupportedType the unsupported type
|
42
|
*/
|
43
|
public InvalidValueTypeException(final Class<?> unsupportedType) {
|
44
|
this("type not supported: " + unsupportedType, unsupportedType);
|
45
|
}
|
46
|
|
47
|
/**
|
48
|
* @param format
|
49
|
* @param e
|
50
|
*/
|
51
|
public InvalidValueTypeException(final String message, final Exception e) {
|
52
|
super(message, e);
|
53
|
_unsupportedType = null;
|
54
|
}
|
55
|
|
56
|
/**
|
57
|
* Gets the unsupported type. might be null.
|
58
|
*
|
59
|
* @return the unsupported type
|
60
|
*/
|
61
|
public Class<?> getUnsupportedType() {
|
62
|
return _unsupportedType;
|
63
|
}
|
64
|
|
65
|
}
|