1
|
package eu.dnetlib.functionality.index.model;
|
2
|
|
3
|
import java.util.Iterator;
|
4
|
|
5
|
/**
|
6
|
* Interface for metadata objects.
|
7
|
*/
|
8
|
public interface Any extends Iterable<Any> {
|
9
|
|
10
|
/**
|
11
|
* Enumeration with the possible value types.
|
12
|
*
|
13
|
*/
|
14
|
public enum ValueType {
|
15
|
|
16
|
/**
|
17
|
* The list with the possible value types. MAP map, SEQ sequence, STRING string value, DOUBLE double value,
|
18
|
* BOOLEAN Boolean value, LONG long value, DATE date (without time), DATETIME date with time
|
19
|
*/
|
20
|
MAP, SEQ, STRING, DOUBLE, BOOLEAN, LONG, DATE, DATETIME
|
21
|
};
|
22
|
|
23
|
/**
|
24
|
* @return value type
|
25
|
*/
|
26
|
ValueType getValueType();
|
27
|
|
28
|
/**
|
29
|
* @return true if value is of type map
|
30
|
*/
|
31
|
boolean isMap();
|
32
|
|
33
|
/**
|
34
|
* @return true if value is of type sequence
|
35
|
*/
|
36
|
boolean isSeq();
|
37
|
|
38
|
/**
|
39
|
* @return true if value is of type value
|
40
|
*/
|
41
|
boolean isValue();
|
42
|
|
43
|
/**
|
44
|
* @return true if value is of type string
|
45
|
*/
|
46
|
boolean isString();
|
47
|
|
48
|
/**
|
49
|
* @return true if value is of type double
|
50
|
*/
|
51
|
boolean isDouble();
|
52
|
|
53
|
/**
|
54
|
* @return true if value is of type boolean
|
55
|
*/
|
56
|
boolean isBoolean();
|
57
|
|
58
|
/**
|
59
|
* @return true if value is of type long
|
60
|
*/
|
61
|
boolean isLong();
|
62
|
|
63
|
/**
|
64
|
* @return true if value is of type date
|
65
|
*/
|
66
|
boolean isDate();
|
67
|
|
68
|
/**
|
69
|
* @return true if value is of type date time
|
70
|
*/
|
71
|
boolean isDateTime();
|
72
|
|
73
|
/**
|
74
|
* @return true if value is of type long or double
|
75
|
*/
|
76
|
boolean isNumber();
|
77
|
|
78
|
/**
|
79
|
* @return data factory to create Anys of the same kind.
|
80
|
*/
|
81
|
DataFactory getFactory();
|
82
|
|
83
|
/**
|
84
|
* @return iterator over elements. For {@link Value}, this return an iterator about the value itself. For
|
85
|
* {@link AnyMap} it returns an iterator on the values.
|
86
|
*/
|
87
|
@Override
|
88
|
Iterator<Any> iterator();
|
89
|
|
90
|
/**
|
91
|
* @return true, if the Any does not have content. For {@link Value}: returns always false.
|
92
|
*/
|
93
|
boolean isEmpty();
|
94
|
|
95
|
/**
|
96
|
* @return size of Any. For {@link Value} this is always 1.
|
97
|
*/
|
98
|
int size();
|
99
|
|
100
|
/**
|
101
|
* returns this Any as an {@link Value} object or throws an {@link InvalidValueTypeException}.
|
102
|
*/
|
103
|
Value asValue();
|
104
|
|
105
|
/**
|
106
|
* returns this Any as an {@link AnyMap} object or throws an {@link InvalidValueTypeException}.
|
107
|
*/
|
108
|
AnyMap asMap();
|
109
|
|
110
|
/**
|
111
|
* returns this Any as an {@link AnySeq} object or throws an {@link InvalidValueTypeException}.
|
112
|
*/
|
113
|
AnySeq asSeq();
|
114
|
|
115
|
}
|