@@ -37,6 +37,7 @@ public MappingConverter(IBaseAeroMapper mapper, IAerospikeClient aerospikeClient
37
37
/**
38
38
* Translate a Java object to an Aerospike format object. Note that this could potentially have performance issues as
39
39
* the type information of the passed object must be determined on every call.
40
+ *
40
41
* @param obj A given Java object.
41
42
* @return An Aerospike format object.
42
43
*/
@@ -51,6 +52,7 @@ public Object translateToAerospike(Object obj) {
51
52
/**
52
53
* Translate an Aerospike object to a Java object. Note that this could potentially have performance issues as
53
54
* the type information of the passed object must be determined on every call.
55
+ *
54
56
* @param obj A given Java object.
55
57
* @return An Aerospike format object.
56
58
*/
@@ -66,10 +68,12 @@ public <T> T translateFromAerospike(@NotNull Object obj, @NotNull Class<T> expec
66
68
// The following are convenience methods to convert objects to / from lists / maps / records in case
67
69
// it is needed to perform this operation manually. They will not be needed in most use cases.
68
70
// --------------------------------------------------------------------------------------------------
71
+
69
72
/**
70
73
* Given a record loaded from Aerospike and a class type, attempt to convert the record to
71
74
* an instance of the passed class.
72
- * @param clazz The class type to convert the Aerospike record to.
75
+ *
76
+ * @param clazz The class type to convert the Aerospike record to.
73
77
* @param record The Aerospike record to convert.
74
78
* @return A virtual list.
75
79
* @throws AerospikeException an AerospikeException will be thrown in case of an encountering a ReflectiveOperationException.
@@ -85,9 +89,10 @@ public <T> T convertToObject(Class<T> clazz, Record record) {
85
89
/**
86
90
* Given a record loaded from Aerospike and a class type, attempt to convert the record to
87
91
* an instance of the passed class.
88
- * @param clazz The class type to convert the Aerospike record to.
92
+ *
93
+ * @param clazz The class type to convert the Aerospike record to.
89
94
* @param record The Aerospike record to convert.
90
- * @param entry The entry that holds information on how to store the provided class.
95
+ * @param entry The entry that holds information on how to store the provided class.
91
96
* @return A virtual list.
92
97
* @throws AerospikeException an AerospikeException will be thrown in case of an encountering a ReflectiveOperationException.
93
98
*/
@@ -112,7 +117,8 @@ public <T> T convertToObject(Class<T> clazz, Record record, ClassCacheEntry<T> e
112
117
/**
113
118
* Given a list of records loaded from Aerospike and a class type, attempt to convert the records to
114
119
* an instance of the passed class.
115
- * @param clazz The class type to convert the Aerospike record to.
120
+ *
121
+ * @param clazz The class type to convert the Aerospike record to.
116
122
* @param record The Aerospike records to convert.
117
123
* @return A virtual list.
118
124
* @throws AerospikeException an AerospikeException will be thrown in case of an encountering a ReflectiveOperationException.
@@ -142,7 +148,8 @@ public <T> T convertToObject(Class<T> clazz, List<Object> record, boolean resolv
142
148
/**
143
149
* Given a map of records loaded from Aerospike and a class type, attempt to convert the records to
144
150
* an instance of the passed class.
145
- * @param clazz The class type to convert the Aerospike record to.
151
+ *
152
+ * @param clazz The class type to convert the Aerospike record to.
146
153
* @param record The Aerospike records to convert.
147
154
* @return A virtual list.
148
155
* @throws AerospikeException an AerospikeException will be thrown in case of an encountering a ReflectiveOperationException.
@@ -154,9 +161,11 @@ public <T> T convertToObject(Class<T> clazz, Map<String, Object> record) {
154
161
155
162
/**
156
163
* Given an instance of a class (of any type), convert its properties to a list
164
+ *
157
165
* @param instance The instance of a class (of any type).
158
166
* @return a List of the properties of the given instance.
159
167
*/
168
+ @ SuppressWarnings ("unchecked" )
160
169
public <T > List <Object > convertToList (@ NotNull T instance ) {
161
170
ClassCacheEntry <T > entry = (ClassCacheEntry <T >) ClassCache .getInstance ().loadClass (instance .getClass (), mapper );
162
171
return entry .getList (instance , false , false );
@@ -165,9 +174,11 @@ public <T> List<Object> convertToList(@NotNull T instance) {
165
174
/**
166
175
* Given an instance of a class (of any type), convert its properties to a map, properties names will use as the
167
176
* key and properties values will be the values.
177
+ *
168
178
* @param instance The instance of a class (of any type).
169
179
* @return the properties {@link Map} of the given instance.
170
180
*/
181
+ @ SuppressWarnings ("unchecked" )
171
182
public <T > Map <String , Object > convertToMap (@ NotNull T instance ) {
172
183
ClassCacheEntry <T > entry = (ClassCacheEntry <T >) ClassCache .getInstance ().loadClass (instance .getClass (), mapper );
173
184
return entry .getMap (instance , false );
@@ -180,6 +191,7 @@ private Key createKey(ClassCacheEntry<?> entry, DeferredObjectLoader.DeferredObj
180
191
return new Key (entry .getNamespace (), entry .getSetName (), Value .get (entry .translateKeyToAerospikeKey (deferredObject .getKey ())));
181
192
}
182
193
}
194
+
183
195
/**
184
196
* If an object refers to other objects (eg A has a list of B via references), then reading the object will populate the
185
197
* ids. If configured to do so, these objects can be loaded via a batch load and populated back into the references which
@@ -190,6 +202,7 @@ private Key createKey(ClassCacheEntry<?> entry, DeferredObjectLoader.DeferredObj
190
202
* the list of deferred objects is empty. The deferred objects are stored in a <pre>ThreadLocalData<pre> list, so are thread safe
191
203
* @param parentEntity - the ClassCacheEntry of the parent entity. This is used to get the batch policy to use.
192
204
*/
205
+ @ SuppressWarnings ("unchecked" )
193
206
public void resolveDependencies (ClassCacheEntry <?> parentEntity ) {
194
207
List <DeferredObjectLoader .DeferredObjectSetter > deferredObjects = DeferredObjectLoader .getAndClear ();
195
208
0 commit comments