1
|
package eu.dnetlib.clients.index.model;
|
2
|
|
3
|
import java.util.Date;
|
4
|
|
5
|
import eu.dnetlib.clients.index.model.Any.ValueType;
|
6
|
|
7
|
/**
|
8
|
* Interface for creation of data objects.
|
9
|
*/
|
10
|
public interface DataFactory {
|
11
|
|
12
|
/**
|
13
|
* default instance.
|
14
|
*/
|
15
|
DataFactory DEFAULT = DataFactoryCreator.newInstance();
|
16
|
|
17
|
/**
|
18
|
* @return The created AnyMap object
|
19
|
*/
|
20
|
AnyMap createAnyMap();
|
21
|
|
22
|
/**
|
23
|
* @return The created AnySeq object
|
24
|
*/
|
25
|
AnySeq createAnySeq();
|
26
|
|
27
|
/**
|
28
|
* @param value the String to create the Value from.
|
29
|
* @return The created Value object.
|
30
|
*/
|
31
|
Value createStringValue(String value);
|
32
|
|
33
|
/**
|
34
|
* @param value the Boolean to create the Value from.
|
35
|
* @return The created Value object.
|
36
|
*/
|
37
|
Value createBooleanValue(Boolean value);
|
38
|
|
39
|
/**
|
40
|
* @param value the Long to create the Value from.
|
41
|
* @return The created Value object.
|
42
|
*/
|
43
|
Value createLongValue(Long value);
|
44
|
|
45
|
/**
|
46
|
* @param value the int to create the Value from.
|
47
|
* @return The created Value object.
|
48
|
*/
|
49
|
Value createLongValue(int value);
|
50
|
|
51
|
/**
|
52
|
* @param value the Double to create the Value from.
|
53
|
* @return The created Value object.
|
54
|
*/
|
55
|
Value createDoubleValue(Double value);
|
56
|
|
57
|
/**
|
58
|
* @param value the float to create the Value from.
|
59
|
* @return The created Value object.
|
60
|
*/
|
61
|
Value createDoubleValue(float value);
|
62
|
|
63
|
/**
|
64
|
* @param value the Date to create the Value from.
|
65
|
* @return The created Value object.
|
66
|
*/
|
67
|
Value createDateValue(Date value);
|
68
|
|
69
|
/**
|
70
|
* @param value the DateTime to create the Value from.
|
71
|
* @return The created Value object.
|
72
|
*/
|
73
|
Value createDateTimeValue(Date value);
|
74
|
|
75
|
/**
|
76
|
* @param value The value
|
77
|
* @param type The type
|
78
|
* @return The Value object with correct type, InvalidvalueTypeException else.
|
79
|
*/
|
80
|
Value parseFromString(String value, String type);
|
81
|
|
82
|
/**
|
83
|
* @param value The value
|
84
|
* @param valueType The value's type
|
85
|
* @return The Value object with correct type, InvalidvalueTypeException else.
|
86
|
*/
|
87
|
Value parseFromString(final String value, final ValueType valueType);
|
88
|
|
89
|
/**
|
90
|
* Tries to convert the String to a Date or Timestamp Value, if not possible return a String Value.
|
91
|
*
|
92
|
* @param value The value to check for Date/Timestamp
|
93
|
* @return The Value object with guessed type, InvalidvalueTypeException if value is null.
|
94
|
*/
|
95
|
Value tryDateTimestampParsingFromString(String value);
|
96
|
|
97
|
/**
|
98
|
* @param object The object
|
99
|
* @return The value matching the class of given object, InvalidValueTypeException otherwise.
|
100
|
* @deprecated Use {@link #autoConvertValue(Object)} instead
|
101
|
*/
|
102
|
@Deprecated
|
103
|
Value parseFromObject(final Object object);
|
104
|
|
105
|
/**
|
106
|
* auto converts the given object into the object's corresponding Value.
|
107
|
*
|
108
|
* @param object The object, must be one of the simple types
|
109
|
* @return The value matching the class of given object, InvalidValueTypeException otherwise.
|
110
|
*/
|
111
|
Value autoConvertValue(final Object object);
|
112
|
|
113
|
/**
|
114
|
* Clone Any object.
|
115
|
*
|
116
|
* @param source the source
|
117
|
* @return the attribute
|
118
|
*/
|
119
|
Any cloneAny(final Any source);
|
120
|
|
121
|
/**
|
122
|
* Clone AnyMap object.
|
123
|
*
|
124
|
* @param source the source
|
125
|
* @return the attribute
|
126
|
*/
|
127
|
AnyMap cloneAnyMap(final AnyMap source);
|
128
|
|
129
|
/**
|
130
|
* Clone AnySeq object.
|
131
|
*
|
132
|
* @param source the source
|
133
|
* @return the attribute
|
134
|
*/
|
135
|
AnySeq cloneAnySeq(final AnySeq source);
|
136
|
|
137
|
}
|