From 60a5959a3e94dff3d5d4347e473504973dbf096b Mon Sep 17 00:00:00 2001 From: GhouseK1 Date: Wed, 11 May 2022 20:07:02 +0530 Subject: [PATCH] replaced traditional getter setter with lombok getter setter --- src/main/java/com/meilisearch/sdk/Config.java | 21 +-- .../java/com/meilisearch/sdk/Details.java | 100 +------------ src/main/java/com/meilisearch/sdk/Dump.java | 9 +- .../sdk/GenericServiceTemplate.java | 20 +-- src/main/java/com/meilisearch/sdk/Key.java | 113 ++------------- src/main/java/com/meilisearch/sdk/Result.java | 12 +- .../com/meilisearch/sdk/SearchRequest.java | 136 +----------------- .../java/com/meilisearch/sdk/Settings.java | 18 +-- src/main/java/com/meilisearch/sdk/Task.java | 92 +----------- .../java/com/meilisearch/sdk/TaskError.java | 30 +--- .../meilisearch/sdk/TenantTokenOptions.java | 20 +-- .../sdk/api/documents/SearchRequest.java | 58 +------- .../sdk/api/documents/SearchResponse.java | 30 +--- .../meilisearch/sdk/api/documents/Task.java | 69 +-------- .../com/meilisearch/sdk/api/index/Index.java | 37 +---- .../meilisearch/sdk/api/index/Settings.java | 69 +-------- .../sdk/api/instance/IndexStats.java | 28 +--- .../meilisearch/sdk/api/instance/Stats.java | 28 +--- .../sdk/http/request/BasicHttpRequest.java | 44 +----- .../sdk/http/response/BasicHttpResponse.java | 17 +-- .../meilisearch/sdk/model/SearchResult.java | 19 +-- 21 files changed, 93 insertions(+), 877 deletions(-) diff --git a/src/main/java/com/meilisearch/sdk/Config.java b/src/main/java/com/meilisearch/sdk/Config.java index 3dc798d4..0833919b 100644 --- a/src/main/java/com/meilisearch/sdk/Config.java +++ b/src/main/java/com/meilisearch/sdk/Config.java @@ -1,6 +1,9 @@ package com.meilisearch.sdk; +import lombok.Getter; + /** Meilisearch configuration */ +@Getter public class Config { String hostUrl; String apiKey; @@ -25,24 +28,6 @@ public Config(String hostUrl, String apiKey) { this.apiKey = apiKey; } - /** - * Method for returning the hostUrl - * - * @return host URL string of the Meilisearch instance - */ - public String getHostUrl() { - return hostUrl; - } - - /** - * Method for returning the apiKey - * - * @return API key String - */ - public String getApiKey() { - return apiKey; - } - /** * Method for returning the concatenated Bearer header with apiKey * diff --git a/src/main/java/com/meilisearch/sdk/Details.java b/src/main/java/com/meilisearch/sdk/Details.java index 6af44ddd..841789df 100644 --- a/src/main/java/com/meilisearch/sdk/Details.java +++ b/src/main/java/com/meilisearch/sdk/Details.java @@ -1,7 +1,11 @@ package com.meilisearch.sdk; import java.util.Map; +import lombok.Getter; +import lombok.Setter; +@Getter +@Setter public class Details { public Details() {} @@ -18,100 +22,4 @@ public Details() {} protected String[] stopWords; protected Map synonyms; protected String distinctAttribute; - - public int getReceivedDocuments() { - return receivedDocuments; - } - - public void setReceivedDocuments(int receivedDocuments) { - this.receivedDocuments = receivedDocuments; - } - - public int getIndexedDocuments() { - return indexedDocuments; - } - - public void setIndexedDocuments(int indexedDocuments) { - this.indexedDocuments = indexedDocuments; - } - - public int getDeletedDocuments() { - return deletedDocuments; - } - - public void setDeletedDocuments(int deletedDocuments) { - this.deletedDocuments = deletedDocuments; - } - - public String getPrimaryKey() { - return primaryKey; - } - - public void setPrimaryKey(String primaryKey) { - this.primaryKey = primaryKey; - } - - public String[] getRankingRules() { - return rankingRules; - } - - public void setRankingRules(String[] rankingRules) { - this.rankingRules = rankingRules; - } - - public String[] getSearchableAttributes() { - return searchableAttributes; - } - - public void setSearchableAttributes(String[] searchableAttributes) { - this.searchableAttributes = searchableAttributes; - } - - public String[] getDisplayedAttributes() { - return displayedAttributes; - } - - public void setDisplayedAttributes(String[] displayedAttributes) { - this.displayedAttributes = displayedAttributes; - } - - public String[] getFilterableAttributes() { - return filterableAttributes; - } - - public void setFilterableAttributes(String[] filterableAttributes) { - this.filterableAttributes = filterableAttributes; - } - - public String[] getSortableAttributes() { - return sortableAttributes; - } - - public void setSortableAttributes(String[] sortableAttributes) { - this.sortableAttributes = sortableAttributes; - } - - public String[] getStopWords() { - return stopWords; - } - - public void setStopWords(String[] stopWords) { - this.stopWords = stopWords; - } - - public Map getSynonyms() { - return synonyms; - } - - public void setSynonyms(Map synonyms) { - this.synonyms = synonyms; - } - - public String getDistinctAttribute() { - return distinctAttribute; - } - - public void setDistinctAttribute(String distinctAttribute) { - this.distinctAttribute = distinctAttribute; - } } diff --git a/src/main/java/com/meilisearch/sdk/Dump.java b/src/main/java/com/meilisearch/sdk/Dump.java index 5bc8145a..20ddaa73 100644 --- a/src/main/java/com/meilisearch/sdk/Dump.java +++ b/src/main/java/com/meilisearch/sdk/Dump.java @@ -4,9 +4,10 @@ import lombok.ToString; /** Meilisearch dump */ +@Getter public class Dump { - @Getter private String status; - @Getter private String uid; - @Getter @ToString.Exclude private String startedAt; - @Getter @ToString.Exclude private String finishedAt; + private String status; + private String uid; + @ToString.Exclude private String startedAt; + @ToString.Exclude private String finishedAt; } diff --git a/src/main/java/com/meilisearch/sdk/GenericServiceTemplate.java b/src/main/java/com/meilisearch/sdk/GenericServiceTemplate.java index 0a36c610..7ca05015 100644 --- a/src/main/java/com/meilisearch/sdk/GenericServiceTemplate.java +++ b/src/main/java/com/meilisearch/sdk/GenericServiceTemplate.java @@ -9,7 +9,9 @@ import com.meilisearch.sdk.http.request.HttpRequest; import com.meilisearch.sdk.http.response.HttpResponse; import com.meilisearch.sdk.json.JsonHandler; +import lombok.Getter; +@Getter public class GenericServiceTemplate implements ServiceTemplate { private final AbstractHttpClient client; private final JsonHandler processor; @@ -27,24 +29,6 @@ public GenericServiceTemplate( this.requestFactory = requestFactory; } - /** {@inheritDoc} */ - @Override - public AbstractHttpClient getClient() { - return client; - } - - /** {@inheritDoc} */ - @Override - public JsonHandler getProcessor() { - return processor; - } - - /** {@inheritDoc} */ - @Override - public RequestFactory getRequestFactory() { - return requestFactory; - } - /** {@inheritDoc} */ @Override @SuppressWarnings("unchecked") diff --git a/src/main/java/com/meilisearch/sdk/Key.java b/src/main/java/com/meilisearch/sdk/Key.java index 43cfa181..86580dbb 100644 --- a/src/main/java/com/meilisearch/sdk/Key.java +++ b/src/main/java/com/meilisearch/sdk/Key.java @@ -1,15 +1,19 @@ package com.meilisearch.sdk; -import com.google.gson.*; +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; import java.util.Date; +import lombok.Getter; +import lombok.Setter; /** MeiliSearch response for a Key */ +@Getter public class Key { - protected String description = null; + @Setter protected String description = null; protected String key = ""; - protected String[] actions = null; - protected String[] indexes = null; - protected Date expiresAt = null; + @Setter protected String[] actions = null; + @Setter protected String[] indexes = null; + @Setter protected Date expiresAt = null; protected Date createdAt = null; protected Date updatedAt = null; @@ -27,103 +31,4 @@ public String toString() { Gson gson = builder.serializeNulls().setDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'").create(); return gson.toJson(this); } - - /** - * Method to return the Key value - * - * @return String containing the value of the Key - */ - public String getKey() { - return this.key; - } - - /** - * Method to set the description of the key - * - * @param description A description for the key - */ - public void setDescription(String description) { - this.description = description; - } - - /** - * Method to return the description of the Key - * - * @return String containing the description of the Key - */ - public String getDescription() { - return this.description; - } - - /** - * Method to set the actions authorized by the key - * - * @param actions An array of API actions permitted for the key. - */ - public void setActions(String[] actions) { - this.actions = actions; - } - - /** - * Method to return the actions authorized by the key - * - * @return String containing the actions authorized by the key - */ - public String[] getActions() { - return this.actions; - } - - /** - * Method to set the indexes accessible by the Key - * - * @param indexes An array of indexes the key is authorized to act on - */ - public void setIndexes(String[] indexes) { - this.indexes = indexes; - } - - /** - * Method to return the indexes accessible by the Key - * - * @return String value of the indexes accessible by the Key - */ - public String[] getIndexes() { - return this.indexes; - } - - /** - * Method to set the time that the Key will expire - * - * @param expiredAt Date and time when the key will expire, represented in ISO 8601 format - */ - public void setExpiresAt(Date expiredAt) { - this.expiresAt = expiredAt; - } - - /** - * Method to return the time that the Key will expire - * - * @return Date and time of expiration date of the Key - */ - public Date getExpiresAt() { - return this.expiresAt; - } - - /** - * Method to return the time that the Key was created at - * - * @return Date and time of the Key when it was created - */ - public Date getCreatedAt() { - return this.createdAt; - } - - /** - * Method to return the time that the Update was finished at - * - * @return Date and time of the Update when it was finished - */ - public Date getUpdatedAt() { - return this.updatedAt; - } } diff --git a/src/main/java/com/meilisearch/sdk/Result.java b/src/main/java/com/meilisearch/sdk/Result.java index a04bedcf..f48cf70f 100644 --- a/src/main/java/com/meilisearch/sdk/Result.java +++ b/src/main/java/com/meilisearch/sdk/Result.java @@ -1,10 +1,11 @@ package com.meilisearch.sdk; import com.google.gson.Gson; +import lombok.Getter; /** MeiliSearch response for a Result */ public class Result { - protected T[] results = null; + @Getter protected T[] results = null; private static Gson gsonUpdate = new Gson(); @@ -17,13 +18,4 @@ public class Result { public String toString() { return gsonUpdate.toJson(this); } - - /** - * Method to return the list contained in Result - * - * @return String containing the identifier of the Task - */ - public T[] getResults() { - return this.results; - } } diff --git a/src/main/java/com/meilisearch/sdk/SearchRequest.java b/src/main/java/com/meilisearch/sdk/SearchRequest.java index 58f4c733..085e7a5f 100644 --- a/src/main/java/com/meilisearch/sdk/SearchRequest.java +++ b/src/main/java/com/meilisearch/sdk/SearchRequest.java @@ -1,8 +1,10 @@ package com.meilisearch.sdk; +import lombok.Getter; import org.json.JSONObject; /** Search request query string builder */ +@Getter public class SearchRequest { private String q; private int offset; @@ -320,140 +322,6 @@ private SearchRequest( this.facetsDistribution = facetsDistribution; this.sort = sort; } - /** - * Method for returning the Query String - * - * @return query String - */ - public String getQ() { - return q; - } - - /** - * Method for returning the offset - * - * @return number of documents to skip - */ - public int getOffset() { - return offset; - } - - /** - * Method for returning the limit - * - * @return maximum number of documents returned - */ - public int getLimit() { - return limit; - } - - /** - * Method for returning the attributesToRetrieve - * - * @return attributes whose values will contain highlighted matching terms - */ - public String[] getAttributesToRetrieve() { - return attributesToRetrieve; - } - - /** - * Method for returning the attributesToCrop - * - * @return attributes whose values have to be cropped - */ - public String[] getAttributesToCrop() { - return attributesToCrop; - } - - /** - * Method for returning the cropLength - * - * @return length used to crop field values - */ - public int getCropLength() { - return cropLength; - } - - /** - * Method for returning the cropMarker - * - * @return string containing the crop marker - */ - public String getCropMarker() { - return cropMarker; - } - - /** - * Method for returning the highlightPreTag - * - * @return string containing highlight before tag - */ - public String getHighlightPreTag() { - return highlightPreTag; - } - - /** - * Method for returning the highlightPostTag - * - * @return string containing highlight after tag - */ - public String getHighlightPostTag() { - return highlightPostTag; - } - - /** - * Method for returning the attributesToHighlight - * - * @return attributes whose values will contain highlighted matching terms - */ - public String[] getAttributesToHighlight() { - return attributesToHighlight; - } - - /** - * Method to return the filter - * - * @return filter queries by an attribute value - */ - public String[] getFilter() { - return filter; - } - - /** - * Method to return the filterArray - * - * @return filterArray that can have multiple nested filters - */ - public String[][] getFilterArray() { - return filterArray; - } - /** - * Method to return the matches - * - * @return defines whether an object that contains information about the matches should be - * returned or not - */ - public boolean getMatches() { - return matches; - } - - /** - * Method for returning the facetsDistribution - * - * @return facets for which to retrieve the matching count - */ - public String[] getFacetsDistribution() { - return facetsDistribution; - } - - /** - * Method for returning the sort - * - * @return Sort queries by an attribute value - */ - public String[] getSort() { - return sort; - } /** * Method to set the Query String diff --git a/src/main/java/com/meilisearch/sdk/Settings.java b/src/main/java/com/meilisearch/sdk/Settings.java index 411e646f..f32bdd2d 100644 --- a/src/main/java/com/meilisearch/sdk/Settings.java +++ b/src/main/java/com/meilisearch/sdk/Settings.java @@ -10,15 +10,17 @@ * *

Refer https://docs.meilisearch.com/reference/api/settings.html */ +@Getter +@Setter public class Settings { - @Getter @Setter private HashMap synonyms; - @Getter @Setter private String[] stopWords; - @Getter @Setter private String[] rankingRules; - @Getter @Setter private String[] filterableAttributes; - @Getter @Setter private String distinctAttribute; - @Getter @Setter private String[] searchableAttributes; - @Getter @Setter private String[] displayedAttributes; - @Getter @Setter private String[] sortableAttributes; + private HashMap synonyms; + private String[] stopWords; + private String[] rankingRules; + private String[] filterableAttributes; + private String distinctAttribute; + private String[] searchableAttributes; + private String[] displayedAttributes; + private String[] sortableAttributes; /** Empty SettingsRequest constructor */ public Settings() {} diff --git a/src/main/java/com/meilisearch/sdk/Task.java b/src/main/java/com/meilisearch/sdk/Task.java index 4dde11d5..5cffbcfd 100644 --- a/src/main/java/com/meilisearch/sdk/Task.java +++ b/src/main/java/com/meilisearch/sdk/Task.java @@ -2,8 +2,10 @@ import com.google.gson.Gson; import java.util.Date; +import lombok.Getter; /** MeiliSearch response for a Task */ +@Getter public class Task { protected String status = ""; protected int uid = 0; @@ -27,94 +29,4 @@ public class Task { public String toString() { return gsonTask.toJson(this); } - - /** - * Method to return the status of the Task object - * - * @return String containing the status of the Task Object - */ - public String getStatus() { - return this.status; - } - - /** - * Method to return the uid of the Task - * - * @return String containing the identifier of the Task - */ - public int getUid() { - return this.uid; - } - - /** - * Method to return the index uid of the Task - * - * @return String containing the index identifier of the Task - */ - public String getIndexUid() { - return this.indexUid; - } - - /** - * Method to return the type of the Task - * - * @return String value of the type of the Task - */ - public String getType() { - return this.type; - } - - /** - * Method to return the elapsed time of the Task - * - * @return String value of the duration of the Task - */ - public String getDuration() { - return this.duration; - } - - /** - * Method to return the time that the Task was enqueued at - * - * @return Date and time of the Task when it was enqueued - */ - public Date getEnqueuedAt() { - return this.enqueuedAt; - } - - /** - * Method to return the time that the Task was started at - * - * @return Date and time of the Task when it was started - */ - public Date getStartedAt() { - return this.startedAt; - } - - /** - * Method to return the time that the Update was finished at - * - * @return Date and time of the Update when it was finished - */ - public Date getFinishedAt() { - return this.finishedAt; - } - - /** - * Method to return the error of the Task - * - * @return error Object with the code, type and link of the Task Error - */ - public TaskError getError() { - return this.error; - } - - /** - * Method to return the details of the task - * - * @return Details Object with fields - */ - public Details getDetails() { - return this.details; - } } diff --git a/src/main/java/com/meilisearch/sdk/TaskError.java b/src/main/java/com/meilisearch/sdk/TaskError.java index 2c08bfdc..2b63c3c9 100644 --- a/src/main/java/com/meilisearch/sdk/TaskError.java +++ b/src/main/java/com/meilisearch/sdk/TaskError.java @@ -1,5 +1,11 @@ package com.meilisearch.sdk; + +import lombok.Getter; +import lombok.Setter; + /** The code, type and error of the task error */ +@Getter +@Setter public class TaskError { public TaskError() {} @@ -7,28 +13,4 @@ public TaskError() {} protected String taskErrorCode = ""; protected String taskErrorType = ""; protected String taskErrorLink = ""; - - public String getTaskErrorCode() { - return taskErrorCode; - } - - public void setTaskErrorCode(String taskErrorCode) { - this.taskErrorCode = taskErrorCode; - } - - public String getTaskErrorType() { - return taskErrorType; - } - - public void setTaskErrorType(String taskErrorType) { - this.taskErrorType = taskErrorType; - } - - public String getTaskErrorLink() { - return taskErrorLink; - } - - public void setTaskErrorLink(String taskErrorLink) { - this.taskErrorLink = taskErrorLink; - } } diff --git a/src/main/java/com/meilisearch/sdk/TenantTokenOptions.java b/src/main/java/com/meilisearch/sdk/TenantTokenOptions.java index c27882db..be938a2f 100644 --- a/src/main/java/com/meilisearch/sdk/TenantTokenOptions.java +++ b/src/main/java/com/meilisearch/sdk/TenantTokenOptions.java @@ -1,28 +1,16 @@ package com.meilisearch.sdk; import java.util.Date; +import lombok.Getter; +import lombok.Setter; /** The option you want to pass for generate a Tenant Token */ +@Getter +@Setter public class TenantTokenOptions { public TenantTokenOptions() {} protected String apiKey = null; protected Date expiresAt = null; - - public String getApiKey() { - return apiKey; - } - - public void setApiKey(String apiKey) { - this.apiKey = apiKey; - } - - public Date getExpiresAt() { - return expiresAt; - } - - public void setExpiresAt(Date expiresAt) { - this.expiresAt = expiresAt; - } } diff --git a/src/main/java/com/meilisearch/sdk/api/documents/SearchRequest.java b/src/main/java/com/meilisearch/sdk/api/documents/SearchRequest.java index 8246d5a4..de71c568 100644 --- a/src/main/java/com/meilisearch/sdk/api/documents/SearchRequest.java +++ b/src/main/java/com/meilisearch/sdk/api/documents/SearchRequest.java @@ -2,7 +2,9 @@ import java.util.Collections; import java.util.List; +import lombok.Getter; +@Getter public class SearchRequest { private final String q; private final int offset; @@ -197,60 +199,4 @@ public SearchRequest( this.matches = matches; this.sort = sort; } - - public String getQ() { - return q; - } - - public int getOffset() { - return offset; - } - - public int getLimit() { - return limit; - } - - public List getAttributesToRetrieve() { - return attributesToRetrieve; - } - - public List getAttributesToCrop() { - return attributesToCrop; - } - - public int getCropLength() { - return cropLength; - } - - public String getHighlightPreTag() { - return highlightPreTag; - } - - public String getHighlightPostTag() { - return highlightPostTag; - } - - public String getCropMarker() { - return cropMarker; - } - - public List getAttributesToHighlight() { - return attributesToHighlight; - } - - public String[] getFilter() { - return filter; - } - - public String[][] getFilterArray() { - return filterArray; - } - - public List getSort() { - return sort; - } - - public boolean isMatches() { - return matches; - } } diff --git a/src/main/java/com/meilisearch/sdk/api/documents/SearchResponse.java b/src/main/java/com/meilisearch/sdk/api/documents/SearchResponse.java index 6f482700..f94d9de0 100644 --- a/src/main/java/com/meilisearch/sdk/api/documents/SearchResponse.java +++ b/src/main/java/com/meilisearch/sdk/api/documents/SearchResponse.java @@ -1,7 +1,9 @@ package com.meilisearch.sdk.api.documents; import java.util.List; +import lombok.Getter; +@Getter public class SearchResponse { private List hits; private int offset; @@ -10,32 +12,4 @@ public class SearchResponse { private boolean exhaustiveNbHits; private int processingTimeMs; private String query; - - public List getHits() { - return hits; - } - - public int getOffset() { - return offset; - } - - public int getLimit() { - return limit; - } - - public int getNbHits() { - return nbHits; - } - - public boolean isExhaustiveNbHits() { - return exhaustiveNbHits; - } - - public int getProcessingTimeMs() { - return processingTimeMs; - } - - public String getQuery() { - return query; - } } diff --git a/src/main/java/com/meilisearch/sdk/api/documents/Task.java b/src/main/java/com/meilisearch/sdk/api/documents/Task.java index 48aa60cf..3ea17cda 100644 --- a/src/main/java/com/meilisearch/sdk/api/documents/Task.java +++ b/src/main/java/com/meilisearch/sdk/api/documents/Task.java @@ -1,5 +1,10 @@ package com.meilisearch.sdk.api.documents; +import lombok.Getter; +import lombok.Setter; + +@Getter +@Setter public class Task { private String status; private int uid; @@ -9,68 +14,4 @@ public class Task { private String enqueuedAt; private String startedAt; private String finishedAt; - - public void setStatus(String status) { - this.status = status; - } - - public String getStatus() { - return this.status; - } - - public void setUid(int uid) { - this.uid = uid; - } - - public int getUid() { - return this.uid; - } - - public void setIndexUid(String indexUid) { - this.indexUid = indexUid; - } - - public String getIndexUid() { - return this.indexUid; - } - - public void setType(String type) { - this.type = type; - } - - public String getType() { - return this.type; - } - - public void setDuration(String duration) { - this.duration = duration; - } - - public String getDuration() { - return this.duration; - } - - public void setEnqueuedAt(String enqueuedAt) { - this.enqueuedAt = enqueuedAt; - } - - public String getEnqueuedAt() { - return this.enqueuedAt; - } - - public void setStartedAt(String startedAt) { - this.startedAt = startedAt; - } - - public String getStartedAt() { - return this.startedAt; - } - - public void setFinishedAt(String finishedAt) { - this.finishedAt = finishedAt; - } - - public String getFinishedAt() { - return this.finishedAt; - } } diff --git a/src/main/java/com/meilisearch/sdk/api/index/Index.java b/src/main/java/com/meilisearch/sdk/api/index/Index.java index 06193b83..42b72bfe 100644 --- a/src/main/java/com/meilisearch/sdk/api/index/Index.java +++ b/src/main/java/com/meilisearch/sdk/api/index/Index.java @@ -1,40 +1,13 @@ package com.meilisearch.sdk.api.index; +import lombok.Getter; +import lombok.Setter; + +@Getter +@Setter public class Index { private String uid; private String primaryKey; private String createdAt; private String updatedAt; - - public String getUid() { - return uid; - } - - public void setUid(String uid) { - this.uid = uid; - } - - public String getPrimaryKey() { - return primaryKey; - } - - public void setPrimaryKey(String primaryKey) { - this.primaryKey = primaryKey; - } - - public String getCreatedAt() { - return createdAt; - } - - public void setCreatedAt(String createdAt) { - this.createdAt = createdAt; - } - - public String getUpdatedAt() { - return updatedAt; - } - - public void setUpdatedAt(String updatedAt) { - this.updatedAt = updatedAt; - } } diff --git a/src/main/java/com/meilisearch/sdk/api/index/Settings.java b/src/main/java/com/meilisearch/sdk/api/index/Settings.java index 667e2182..2ce06fa5 100644 --- a/src/main/java/com/meilisearch/sdk/api/index/Settings.java +++ b/src/main/java/com/meilisearch/sdk/api/index/Settings.java @@ -2,13 +2,16 @@ import com.meilisearch.sdk.Index; import java.util.HashMap; -import java.util.Map; +import lombok.Getter; +import lombok.Setter; /** * Data Structure for the Settings in an {@link Index} * *

Refer https://docs.meilisearch.com/references/settings.html */ +@Getter +@Setter public class Settings { private HashMap synonyms; private String[] stopWords; @@ -21,68 +24,4 @@ public class Settings { /** Empty SettingsRequest constructor */ public Settings() {} - - public Map getSynonyms() { - return synonyms; - } - - public void setSynonyms(Map synonyms) { - this.synonyms = new HashMap<>(synonyms); - } - - public String[] getStopWords() { - return stopWords; - } - - public void setStopWords(String[] stopWords) { - this.stopWords = stopWords; - } - - public String[] getRankingRules() { - return rankingRules; - } - - public void setRankingRules(String[] rankingRules) { - this.rankingRules = rankingRules; - } - - public String[] getFilterableAttributes() { - return filterableAttributes; - } - - public void setFilterableAttributes(String[] filterableAttributes) { - this.filterableAttributes = filterableAttributes; - } - - public String getDistinctAttribute() { - return distinctAttribute; - } - - public void setDistinctAttribute(String distinctAttribute) { - this.distinctAttribute = distinctAttribute; - } - - public String[] getSearchableAttributes() { - return searchableAttributes; - } - - public void setSearchableAttributes(String[] searchableAttributes) { - this.searchableAttributes = searchableAttributes; - } - - public String[] getDisplayedAttributes() { - return displayedAttributes; - } - - public void setDisplayedAttributes(String[] displayedAttributes) { - this.displayedAttributes = displayedAttributes; - } - - public String[] getSortableAttributes() { - return sortableAttributes; - } - - public void setSortableAttributes(String[] sortableAttributes) { - this.sortableAttributes = sortableAttributes; - } } diff --git a/src/main/java/com/meilisearch/sdk/api/instance/IndexStats.java b/src/main/java/com/meilisearch/sdk/api/instance/IndexStats.java index 89797277..27b22ae9 100644 --- a/src/main/java/com/meilisearch/sdk/api/instance/IndexStats.java +++ b/src/main/java/com/meilisearch/sdk/api/instance/IndexStats.java @@ -1,7 +1,11 @@ package com.meilisearch.sdk.api.instance; import java.util.Map; +import lombok.Getter; +import lombok.Setter; +@Getter +@Setter public class IndexStats { private long numberOfDocuments; private boolean isIndexing; @@ -15,28 +19,4 @@ public IndexStats( this.isIndexing = isIndexing; this.fieldDistribution = fieldDistribution; } - - public long getNumberOfDocuments() { - return numberOfDocuments; - } - - public void setNumberOfDocuments(long numberOfDocuments) { - this.numberOfDocuments = numberOfDocuments; - } - - public boolean isIndexing() { - return isIndexing; - } - - public void setIndexing(boolean indexing) { - isIndexing = indexing; - } - - public Map getFieldDistribution() { - return fieldDistribution; - } - - public void setFieldDistribution(Map fieldDistribution) { - this.fieldDistribution = fieldDistribution; - } } diff --git a/src/main/java/com/meilisearch/sdk/api/instance/Stats.java b/src/main/java/com/meilisearch/sdk/api/instance/Stats.java index 1183d621..3d6599cb 100644 --- a/src/main/java/com/meilisearch/sdk/api/instance/Stats.java +++ b/src/main/java/com/meilisearch/sdk/api/instance/Stats.java @@ -2,7 +2,11 @@ import java.util.Date; import java.util.Map; +import lombok.Getter; +import lombok.Setter; +@Getter +@Setter public class Stats { private long databaseSize; private Date lastUpdate; @@ -15,28 +19,4 @@ public Stats(long databaseSize, Date lastUpdate, Map indexes this.lastUpdate = lastUpdate; this.indexes = indexes; } - - public long getDatabaseSize() { - return databaseSize; - } - - public void setDatabaseSize(long databaseSize) { - this.databaseSize = databaseSize; - } - - public Date getLastUpdate() { - return lastUpdate; - } - - public void setLastUpdate(Date lastUpdate) { - this.lastUpdate = lastUpdate; - } - - public Map getIndexes() { - return indexes; - } - - public void setIndexes(Map indexes) { - this.indexes = indexes; - } } diff --git a/src/main/java/com/meilisearch/sdk/http/request/BasicHttpRequest.java b/src/main/java/com/meilisearch/sdk/http/request/BasicHttpRequest.java index 24151b63..cfafb409 100644 --- a/src/main/java/com/meilisearch/sdk/http/request/BasicHttpRequest.java +++ b/src/main/java/com/meilisearch/sdk/http/request/BasicHttpRequest.java @@ -2,11 +2,14 @@ import java.nio.charset.StandardCharsets; import java.util.Map; +import lombok.Getter; +import lombok.Setter; +@Getter public class BasicHttpRequest implements HttpRequest { - private HttpMethod method; - private String path; - private Map headers; + @Setter private HttpMethod method; + @Setter private String path; + @Setter private Map headers; private String content; public BasicHttpRequest() {} @@ -19,46 +22,11 @@ public BasicHttpRequest( this.content = content; } - @Override - public HttpMethod getMethod() { - return this.method; - } - - @Override - public void setMethod(HttpMethod method) { - this.method = method; - } - - @Override - public String getPath() { - return this.path; - } - - @Override - public void setPath(String path) { - this.path = path; - } - - @Override - public Map getHeaders() { - return this.headers; - } - - @Override - public void setHeaders(Map headers) { - this.headers = headers; - } - @Override public boolean hasContent() { return content != null; } - @Override - public String getContent() { - return content; - } - @Override public byte[] getContentAsBytes() { return content.getBytes(StandardCharsets.UTF_8); diff --git a/src/main/java/com/meilisearch/sdk/http/response/BasicHttpResponse.java b/src/main/java/com/meilisearch/sdk/http/response/BasicHttpResponse.java index f5fda182..f37e0794 100644 --- a/src/main/java/com/meilisearch/sdk/http/response/BasicHttpResponse.java +++ b/src/main/java/com/meilisearch/sdk/http/response/BasicHttpResponse.java @@ -1,7 +1,9 @@ package com.meilisearch.sdk.http.response; import java.util.Map; +import lombok.Getter; +@Getter public class BasicHttpResponse implements HttpResponse { private final Map headers; private final int statusCode; @@ -13,26 +15,11 @@ public BasicHttpResponse(Map headers, int statusCode, String con this.content = content; } - @Override - public Map getHeaders() { - return headers; - } - - @Override - public int getStatusCode() { - return statusCode; - } - @Override public boolean hasContent() { return content != null; } - @Override - public String getContent() { - return content; - } - @Override public byte[] getContentAsBytes() { return content.getBytes(); diff --git a/src/main/java/com/meilisearch/sdk/model/SearchResult.java b/src/main/java/com/meilisearch/sdk/model/SearchResult.java index 5dcb7c43..5b556f16 100644 --- a/src/main/java/com/meilisearch/sdk/model/SearchResult.java +++ b/src/main/java/com/meilisearch/sdk/model/SearchResult.java @@ -7,24 +7,25 @@ import lombok.ToString; /** Result of `search` API Refer https://docs.meilisearch.com/references/search.html */ +@Getter @ToString public class SearchResult implements Serializable { - @Getter ArrayList> hits; + ArrayList> hits; - @Getter int offset; + int offset; - @Getter int limit; + int limit; - @Getter int nbHits; + int nbHits; - @Getter boolean exhaustiveNbHits; + boolean exhaustiveNbHits; - @Getter Object facetsDistribution; + Object facetsDistribution; - @Getter boolean exhaustiveFacetsCount; + boolean exhaustiveFacetsCount; - @Getter int processingTimeMs; + int processingTimeMs; - @Getter String query; + String query; }