1
|
package eu.dnetlib.functionality.index.model;
|
2
|
|
3
|
import java.util.Date;
|
4
|
|
5
|
/**
|
6
|
* Interface for a value object, used if the any object is of type string, double, boolean, long, date or date time.
|
7
|
*/
|
8
|
public interface Value extends Any {
|
9
|
|
10
|
/**
|
11
|
* @return The string representation
|
12
|
*/
|
13
|
String asString();
|
14
|
|
15
|
/**
|
16
|
* @return The double representation, an InvalidValueTypeException is thrown if the value is not a number. If value
|
17
|
* is a string then this is tried to be converted to a Double.
|
18
|
*/
|
19
|
Double asDouble();
|
20
|
|
21
|
/**
|
22
|
* @return The long representation, an InvalidValueTypeException is thrown if the value is not a number. If value is
|
23
|
* a string then this is tried to be converted to a Long.
|
24
|
*/
|
25
|
Long asLong();
|
26
|
|
27
|
/**
|
28
|
* @return The boolean representation, an InvalidValueTypeException is thrown if the value is not of type boolean.
|
29
|
* If value is a string then this is tried to be converted to a boolean.
|
30
|
*/
|
31
|
Boolean asBoolean();
|
32
|
|
33
|
/**
|
34
|
* @return The date representation, an InvalidValueTypeException is thrown if the value is not of type date or
|
35
|
* datetime. If value is a string then this is tried to be converted to a date.
|
36
|
*/
|
37
|
Date asDate();
|
38
|
|
39
|
/**
|
40
|
* @return The date time representation, an InvalidValueTypeException is thrown if the value is not of type
|
41
|
* datetime. If value is a string then this is tried to be converted to a datetime.
|
42
|
*/
|
43
|
Date asDateTime();
|
44
|
|
45
|
/**
|
46
|
* @return the value object
|
47
|
*/
|
48
|
Object getObject();
|
49
|
}
|