Skip to content
This repository was archived by the owner on Sep 28, 2022. It is now read-only.

Commit ee647f9

Browse files
authored
Merge pull request #143 from kuzzleio/javadoc
fix and standardize javadoc
2 parents 40565c6 + f80116b commit ee647f9

20 files changed

+3281
-2471
lines changed

src/main/java/io/kuzzle/sdk/core/Collection.java

Lines changed: 288 additions & 566 deletions
Large diffs are not rendered by default.

src/main/java/io/kuzzle/sdk/core/CollectionMapping.java

Lines changed: 32 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,6 @@
1010
import io.kuzzle.sdk.listeners.ResponseListener;
1111
import io.kuzzle.sdk.listeners.OnQueryDoneListener;
1212

13-
/**
14-
* The type Kuzzle data mapping.
15-
*/
1613
public class CollectionMapping {
1714

1815
private JSONObject headers;
@@ -22,23 +19,19 @@ public class CollectionMapping {
2219
private Collection dataCollection;
2320

2421
/**
25-
* When creating a new data collection in the persistent data storage layer, Kuzzle uses a default mapping.
26-
* It means that, by default, you won't be able to exploit the full capabilities of our persistent data storage layer
27-
* (currently handled by ElasticSearch), and your searches may suffer from below-average performances, depending on
28-
* the amount of data you stored in a collection and the complexity of your database.
29-
* The CollectionMapping object allow to get the current mapping of a data collection and to modify it if needed.
22+
* Constructor
3023
*
31-
* @param kuzzleDataCollection the kuzzle data collection
24+
* @param kuzzleDataCollection - Parent data collection
3225
*/
3326
public CollectionMapping(final Collection kuzzleDataCollection) {
3427
this(kuzzleDataCollection, null);
3528
}
3629

3730
/**
38-
* Instantiates a new Kuzzle data mapping.
31+
* Constructor
3932
*
40-
* @param kuzzleDataCollection the kuzzle data collection
41-
* @param mapping the mapping
33+
* @param kuzzleDataCollection - Parent data collection
34+
* @param mapping - Mapping content
4235
*/
4336
public CollectionMapping(final Collection kuzzleDataCollection, final JSONObject mapping) {
4437
try {
@@ -57,47 +50,39 @@ public CollectionMapping(final Collection kuzzleDataCollection, final JSONObject
5750
/**
5851
* Copy constructor
5952
*
60-
* @param kuzzleDataMapping the CollectionMapping object to copy
53+
* @param kuzzleDataMapping - The CollectionMapping object to copy
6154
*/
6255
public CollectionMapping(final CollectionMapping kuzzleDataMapping) {
6356
this(kuzzleDataMapping.dataCollection, kuzzleDataMapping.mapping);
6457
}
6558

6659
/**
67-
* Applies the new mapping to the data collection.
68-
*
69-
* @return the kuzzle data mapping
60+
* {@link #apply(Options, ResponseListener)}
7061
*/
7162
public CollectionMapping apply() {
7263
return this.apply(null, null);
7364
}
7465

7566
/**
76-
* Applies the new mapping to the data collection.
77-
*
78-
* @param options the options
79-
* @return the kuzzle data mapping
67+
* {@link #apply(Options, ResponseListener)}
8068
*/
8169
public CollectionMapping apply(final Options options) {
8270
return this.apply(options, null);
8371
}
8472

8573
/**
86-
* Applies the new mapping to the data collection.
87-
*
88-
* @param listener the listener
89-
* @return the kuzzle data mapping
74+
* {@link #apply(Options, ResponseListener)}
9075
*/
9176
public CollectionMapping apply(final ResponseListener<CollectionMapping> listener) {
9277
return this.apply(null, listener);
9378
}
9479

9580
/**
96-
* Applies the new mapping to the data collection.
81+
* Applies this mapping content to the data collection.
9782
*
98-
* @param options the options
99-
* @param listener the cb
100-
* @return the kuzzle data mapping
83+
* @param options - Request options
84+
* @param listener - Response callback listener
85+
* @return this
10186
*/
10287
public CollectionMapping apply(final Options options, final ResponseListener<CollectionMapping> listener) {
10388
JSONObject data = new JSONObject();
@@ -128,9 +113,7 @@ public void onError(JSONObject error) {
128113
}
129114

130115
/**
131-
* Gets a refreshed copy of the current object
132-
*
133-
* @param listener the listener
116+
* {@link #refresh(Options, ResponseListener)}
134117
*/
135118
public void refresh(final ResponseListener<CollectionMapping> listener) {
136119
refresh(null, listener);
@@ -139,8 +122,8 @@ public void refresh(final ResponseListener<CollectionMapping> listener) {
139122
/**
140123
* Gets a refreshed copy of the current object
141124
*
142-
* @param options the options
143-
* @param listener the listener
125+
* @param options - Request options
126+
* @param listener - Response callback listener
144127
*/
145128
public void refresh(final Options options, @NonNull final ResponseListener<CollectionMapping> listener) {
146129
if (listener == null) {
@@ -175,11 +158,11 @@ public void onError(JSONObject object) {
175158
}
176159

177160
/**
178-
* Adds or updates a field mapping.
161+
* Remove a field from this mapping
179162
* Changes made by this function won't be applied until you call the apply method
180163
*
181-
* @param field the field
182-
* @return kuzzle data mapping
164+
* @param field - Field name to remove
165+
* @return this
183166
*/
184167
public CollectionMapping remove(final String field) {
185168
if (this.mapping.has(field)) {
@@ -190,34 +173,29 @@ public CollectionMapping remove(final String field) {
190173
}
191174

192175
/**
193-
* Set kuzzle data mapping.
176+
* Attach a mapping to a field
194177
*
195-
* @param field the field
196-
* @param mapping the mapping
197-
* @return the kuzzle data mapping
198-
* @throws JSONException the json exception
178+
* @param field - Field name
179+
* @param mapping - Field mapping
180+
* @return this
181+
* @throws JSONException
199182
*/
200183
public CollectionMapping set(final String field, final JSONObject mapping) throws JSONException {
201184
this.mapping.put(field, mapping);
202185
return this;
203186
}
204187

205188
/**
206-
* Gets headers.
189+
* Get the global headers for this object
207190
*
208-
* @return the headers
191+
* @return global headers for this object
209192
*/
210193
public JSONObject getHeaders() {
211194
return headers;
212195
}
213196

214197
/**
215-
* Helper function allowing to set headers while chaining calls.
216-
* If the replace argument is set to true, replace the current headers with the provided content.
217-
* Otherwise, it appends the content to the current headers, only replacing already existing values
218-
*
219-
* @param content the headers
220-
* @return the headers
198+
* {@link #setHeaders(JSONObject, boolean)}
221199
*/
222200
public CollectionMapping setHeaders(final JSONObject content) {
223201
return this.setHeaders(content, false);
@@ -228,9 +206,9 @@ public CollectionMapping setHeaders(final JSONObject content) {
228206
* If the replace argument is set to true, replace the current headers with the provided content.
229207
* Otherwise, it appends the content to the current headers, only replacing already existing values
230208
*
231-
* @param content - new headers content
232-
* @param replace - default: false = append the content. If true: replace the current headers with tj
233-
* @return the headers
209+
* @param content - Headers to append or replace
210+
* @param replace - false (default): append the content, true: replace the current headers
211+
* @return this
234212
*/
235213
public CollectionMapping setHeaders(final JSONObject content, final boolean replace) {
236214
try {
@@ -258,9 +236,9 @@ public CollectionMapping setHeaders(final JSONObject content, final boolean repl
258236
}
259237

260238
/**
261-
* Gets mapping.
239+
* Get this mapping raw content
262240
*
263-
* @return the mapping
241+
* @return mapping raw content
264242
*/
265243
public JSONObject getMapping() {
266244
return mapping;

0 commit comments

Comments
 (0)