1
|
package eu.dnetlib.clients.index.model;
|
2
|
|
3
|
import java.util.Date;
|
4
|
import java.util.List;
|
5
|
|
6
|
/**
|
7
|
* Interface for a sequence of Any objects.
|
8
|
* <p>
|
9
|
* <p>
|
10
|
* AnySeq does <b>not</b> allow <code>null</code> values!
|
11
|
* </p>
|
12
|
*/
|
13
|
public interface AnySeq extends List<Any>, Any {
|
14
|
|
15
|
/**
|
16
|
* @param element The string object to add
|
17
|
* @return true if successfully added, false else
|
18
|
*/
|
19
|
boolean add(String element);
|
20
|
|
21
|
/**
|
22
|
* Long, Integer, Short and Byte values will be converted to Value object of type LONG, all others to Value object
|
23
|
* of type DOUBLE.
|
24
|
*
|
25
|
* @param number The number object to add
|
26
|
* @return true if successfully added, false else
|
27
|
*/
|
28
|
boolean add(Number number);
|
29
|
|
30
|
/**
|
31
|
* @param index The index where to add the any object
|
32
|
* @param element The any object to add
|
33
|
*/
|
34
|
@Override
|
35
|
void add(int index, Any element);
|
36
|
|
37
|
/**
|
38
|
* @param index The index of the object to return
|
39
|
* @return The AnyMap matching to the index, an InvalidValueTypeException is thrown if the value is not of type
|
40
|
* AnyMap
|
41
|
*/
|
42
|
AnyMap getMap(int index);
|
43
|
|
44
|
/**
|
45
|
* @param index The index of the object to return
|
46
|
* @return The AnySeq matching to this index, an InvalidValueTypeException is thrown if the value is not of type
|
47
|
*/
|
48
|
AnySeq getSeq(int index);
|
49
|
|
50
|
/**
|
51
|
* @param index The index of the object to return
|
52
|
* @return The value matching to this index, an InvalidValueTypeException is thrown if the value is no value type.
|
53
|
*/
|
54
|
Value getValue(int index);
|
55
|
|
56
|
/**
|
57
|
* @param index The index of the object to return
|
58
|
* @return The string value matching to this index, an InvalidValueTypeException is thrown if the value is not of
|
59
|
* type string
|
60
|
*/
|
61
|
String getStringValue(int index);
|
62
|
|
63
|
/**
|
64
|
* @param index The index of the object to return
|
65
|
* @return The double value matching to this index, an InvalidValueTypeException is thrown if the value is not of
|
66
|
* type double
|
67
|
*/
|
68
|
Double getDoubleValue(int index);
|
69
|
|
70
|
/**
|
71
|
* @param index The index of the object to return
|
72
|
* @return The long value matching to this index, an InvalidValueTypeException is thrown if the value is not of type
|
73
|
* long
|
74
|
*/
|
75
|
Long getLongValue(int index);
|
76
|
|
77
|
/**
|
78
|
* @param index The index of the object to return
|
79
|
* @return The boolean value matching to this index, an InvalidValueTypeException is thrown if the value is not of
|
80
|
* type boolean
|
81
|
*/
|
82
|
Boolean getBooleanValue(int index);
|
83
|
|
84
|
/**
|
85
|
* @param index The index of the object to return
|
86
|
* @return The date value matching to this index, an InvalidValueTypeException is thrown if the value is not of type
|
87
|
* date
|
88
|
*/
|
89
|
Date getDateValue(int index);
|
90
|
|
91
|
/**
|
92
|
* @param index The index of the object to return
|
93
|
* @return The date time value matching to this index, an InvalidValueTypeException is thrown if the value is not of
|
94
|
* type date time
|
95
|
*/
|
96
|
Date getDateTimeValue(int index);
|
97
|
|
98
|
/**
|
99
|
* returns all values as a List of Strings.
|
100
|
*
|
101
|
* @throws InvalidValueTypeException if not all contained values are strings.
|
102
|
*/
|
103
|
List<String> asStrings();
|
104
|
|
105
|
/**
|
106
|
* returns all values as a List of Long.
|
107
|
*
|
108
|
* @throws InvalidValueTypeException if not all contained values are Longs.
|
109
|
*/
|
110
|
List<Long> asLongs();
|
111
|
|
112
|
}
|