Skip to content

Commit f14778d

Browse files
Merge branch 'pr245'
2 parents ad54e33 + c026c3a commit f14778d

File tree

42 files changed

+255
-220
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+255
-220
lines changed

src/main/java/com/ibm/watson/developer_cloud/alchemy/v1/AlchemyDataNews.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
import com.ibm.watson.developer_cloud.alchemy.v1.model.VolumeResult;
2020
import com.ibm.watson.developer_cloud.http.RequestBuilder;
2121
import com.ibm.watson.developer_cloud.service.AlchemyService;
22-
import com.ibm.watson.developer_cloud.util.Validate;
22+
import com.ibm.watson.developer_cloud.util.Validator;
2323

2424
/**
2525
* AlchemyData News indexes 250k to 300k English language news and blog articles every day with
@@ -36,12 +36,12 @@ public class AlchemyDataNews extends AlchemyService {
3636
/**
3737
* The TimeFormat Enumeration.
3838
*/
39-
public static enum TimeFormat {
39+
public enum TimeFormat {
4040

4141
/** The Time format d. */
4242
d, /** The Time format h. */
4343
h, /** The Time format m. */
44-
m, /** The Time format m. */
44+
m, /** The Time format M. */
4545
M, /** The Time format now. */
4646
NOW, /** The Time format s. */
4747
s, /** The Time format y. */
@@ -80,9 +80,9 @@ public static enum TimeFormat {
8080
* @return the news documents
8181
*/
8282
public DocumentsResult getNewsDocuments(Map<String, Object> parameters) {
83-
Validate.notNull(parameters.get(START), "start time cannot be null");
84-
Validate.notNull(parameters.get(END), "end time cannot be null");
85-
Validate.notNull(parameters.get(RETURN), "return cannot be null");
83+
Validator.notNull(parameters.get(START), "start time cannot be null");
84+
Validator.notNull(parameters.get(END), "end time cannot be null");
85+
Validator.notNull(parameters.get(RETURN), "return cannot be null");
8686

8787
// Return json
8888
parameters.put(OUTPUT_MODE, JSON);
@@ -107,8 +107,8 @@ public DocumentsResult getNewsDocuments(Map<String, Object> parameters) {
107107
* @return {@link VolumeResult}
108108
*/
109109
public VolumeResult getVolume(final String start, final String end, final String timeSlice) {
110-
Validate.notNull(start, "start time cannot be null");
111-
Validate.notNull(end, "end time cannot be null");
110+
Validator.notNull(start, "start time cannot be null");
111+
Validator.notNull(end, "end time cannot be null");
112112

113113
final RequestBuilder requestBuilder = RequestBuilder.get(NEWS_END_POINT);
114114

src/main/java/com/ibm/watson/developer_cloud/alchemy/v1/AlchemyVision.java

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
import com.ibm.watson.developer_cloud.http.HttpMediaType;
3131
import com.ibm.watson.developer_cloud.http.RequestBuilder;
3232
import com.ibm.watson.developer_cloud.service.AlchemyService;
33-
import com.ibm.watson.developer_cloud.util.Validate;
33+
import com.ibm.watson.developer_cloud.util.Validator;
3434
import com.squareup.okhttp.RequestBody;
3535

3636
/**
@@ -130,8 +130,8 @@ private <T extends AlchemyGenericModel> T executeRequest(Map<String, Object> par
130130
* @return {@link ImageSceneText}
131131
*/
132132
public ImageSceneText getImageSceneText(File image) {
133-
Validate.notNull(image, "image cannot be null");
134-
Validate.isTrue(image.exists(), "image file: " + image.getAbsolutePath() + " not found");
133+
Validator.notNull(image, "image cannot be null");
134+
Validator.isTrue(image.exists(), "image file: " + image.getAbsolutePath() + " not found");
135135

136136
final Map<String, Object> params = new HashMap<String, Object>();
137137
params.put(IMAGE, image);
@@ -147,7 +147,7 @@ public ImageSceneText getImageSceneText(File image) {
147147
* @return {@link ImageSceneText}
148148
*/
149149
public ImageSceneText getImageSceneText(URL url) {
150-
Validate.notNull(url, "url cannot be null");
150+
Validator.notNull(url, "url cannot be null");
151151

152152
final Map<String, Object> params = new HashMap<String, Object>();
153153
params.put(URL, url);
@@ -164,8 +164,8 @@ public ImageSceneText getImageSceneText(URL url) {
164164
* @return {@link ImageKeywords}
165165
*/
166166
public ImageKeywords getImageKeywords(File image, Boolean forceShowAll, Boolean knowledgeGraph) {
167-
Validate.notNull(image, "image cannot be null");
168-
Validate.isTrue(image.exists(), "image file: " + image.getAbsolutePath() + " not found");
167+
Validator.notNull(image, "image cannot be null");
168+
Validator.isTrue(image.exists(), "image file: " + image.getAbsolutePath() + " not found");
169169

170170
final Map<String, Object> params = new HashMap<String, Object>();
171171
params.put(IMAGE, image);
@@ -198,7 +198,7 @@ public ImageKeywords getImageKeywords(File image, Boolean forceShowAll, Boolean
198198
* @return {@link ImageKeywords}
199199
*/
200200
public ImageKeywords getImageKeywords(URL url, Boolean forceShowAll, Boolean knowledgeGraph) {
201-
Validate.notNull(url, "url cannot be null");
201+
Validator.notNull(url, "url cannot be null");
202202

203203
final Map<String, Object> params = new HashMap<String, Object>();
204204
params.put(URL, url);
@@ -219,7 +219,7 @@ public ImageKeywords getImageKeywords(URL url, Boolean forceShowAll, Boolean kno
219219
* @return {@link ImageLink}
220220
*/
221221
public ImageLink getImageLink(URL url) {
222-
Validate.notNull(url, "url cannot be null");
222+
Validator.notNull(url, "url cannot be null");
223223

224224
final Map<String, Object> params = new HashMap<String, Object>();
225225
params.put(URL, url);
@@ -234,7 +234,7 @@ public ImageLink getImageLink(URL url) {
234234
* @return {@link ImageLink}
235235
*/
236236
public ImageLink getImageLink(String html) {
237-
Validate.notNull(html, "html cannot be null");
237+
Validator.notNull(html, "html cannot be null");
238238

239239
final Map<String, Object> params = new HashMap<String, Object>();
240240
params.put(HTML, html);
@@ -269,8 +269,8 @@ public ImageLink getImageLink(String html) {
269269
* @return {@link ImageFaces}
270270
*/
271271
public ImageFaces recognizeFaces(File image, Boolean knowledgeGraph) {
272-
Validate.notNull(image, "image cannot be null");
273-
Validate.isTrue(image.exists(), "image file: " + image.getAbsolutePath() + " not found");
272+
Validator.notNull(image, "image cannot be null");
273+
Validator.isTrue(image.exists(), "image file: " + image.getAbsolutePath() + " not found");
274274

275275
final Map<String, Object> params = new HashMap<String, Object>();
276276
params.put(IMAGE, image);
@@ -309,7 +309,7 @@ public ImageFaces recognizeFaces(File image, Boolean knowledgeGraph) {
309309
* @return {@link ImageFaces}
310310
*/
311311
public ImageFaces recognizeFaces(URL url, Boolean knowledgeGraph) {
312-
Validate.notNull(url, "url cannot be null");
312+
Validator.notNull(url, "url cannot be null");
313313

314314
final Map<String, Object> params = new HashMap<String, Object>();
315315
params.put(URL, url);

src/main/java/com/ibm/watson/developer_cloud/alchemy/v1/model/ImageSceneText.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,9 +61,9 @@ public String getSceneText() {
6161
}
6262

6363
/**
64-
* Sets the image faces.
64+
* Sets the image texts.
6565
*
66-
* @param imageFaces The imageFaces
66+
* @param imageTexts The imageTexts
6767
*/
6868
public void setSceneTextLines(List<ImageSceneTextLine> imageTexts) {
6969
this.sceneTextLines = imageTexts;
Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,24 @@
1+
/**
2+
* Copyright 2015 IBM Corp. All Rights Reserved.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
5+
* in compliance with the License. You may obtain a copy of the License at
6+
*
7+
* http://www.apache.org/licenses/LICENSE-2.0
8+
*
9+
* Unless required by applicable law or agreed to in writing, software distributed under the License
10+
* is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
11+
* or implied. See the License for the specific language governing permissions and limitations under
12+
* the License.
13+
*/
114
package com.ibm.watson.developer_cloud.alchemy.v1.model;
215

16+
import com.ibm.watson.developer_cloud.alchemy.v1.AlchemyLanguage;
17+
18+
/**
19+
* Supported Language by the {@link AlchemyLanguage} service.
20+
*
21+
*/
322
public enum LanguageSelection {
4-
ENGLISH, FRENCH, GERMAN, ITALIAN, PORTUGESE, RUSSIAN, SPANISH, SWEDISH, DETECT
23+
ENGLISH, FRENCH, GERMAN, ITALIAN, PORTUGUESE, RUSSIAN, SPANISH, SWEDISH, DETECT
524
}

src/main/java/com/ibm/watson/developer_cloud/concept_insights/v2/ConceptInsights.java

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,8 @@
4747
import com.ibm.watson.developer_cloud.service.WatsonService;
4848
import com.ibm.watson.developer_cloud.service.model.GenericModel;
4949
import com.ibm.watson.developer_cloud.util.GsonSingleton;
50-
import com.ibm.watson.developer_cloud.util.ResponseUtil;
51-
import com.ibm.watson.developer_cloud.util.Validate;
50+
import com.ibm.watson.developer_cloud.util.ResponseUtils;
51+
import com.ibm.watson.developer_cloud.util.Validator;
5252
import com.squareup.okhttp.Request;
5353
import com.squareup.okhttp.Response;
5454

@@ -214,14 +214,14 @@ public ConceptInsights() {
214214
*/
215215
public Annotations annotateText(final Graph graph, final String text) {
216216
final String graphId = IDHelper.getGraphId(graph, getFirstAccountId());
217-
Validate.notEmpty(text, "text cannot be empty");
217+
Validator.notEmpty(text, "text cannot be empty");
218218

219219
final Request request = RequestBuilder.post(API_VERSION + graphId + ANNOTATE_TEXT_PATH)
220220
.withBodyContent(text, HttpMediaType.TEXT_PLAIN)
221221
.withHeader(HttpHeaders.ACCEPT, HttpMediaType.APPLICATION_JSON).build();
222222

223223
final Response response = execute(request);
224-
return ResponseUtil.getObject(response, Annotations.class);
224+
return ResponseUtils.getObject(response, Annotations.class);
225225
}
226226

227227
/**
@@ -241,7 +241,7 @@ public Annotations annotateText(final Graph graph, final String text) {
241241
* @return {@link QueryConcepts}
242242
*/
243243
public QueryConcepts conceptualSearch(Corpus corpus, Map<String, Object> parameters) {
244-
Validate.notNull(parameters.get(IDS), "ids cannot be null");
244+
Validator.notNull(parameters.get(IDS), "ids cannot be null");
245245
final String corpusId = IDHelper.getCorpusId(corpus, getFirstAccountId());
246246

247247
final Map<String, Object> queryParams = new HashMap<String, Object>();
@@ -482,7 +482,7 @@ public Concepts getCorpusRelatedConcepts(final Corpus corpus,
482482
*/
483483
public Scores getCorpusRelationScores(final Corpus corpus, final List<Concept> concepts) {
484484
final String corpusId = IDHelper.getCorpusId(corpus, getFirstAccountId());
485-
Validate.notEmpty(concepts, "concepts cannot be empty");
485+
Validator.notEmpty(concepts, "concepts cannot be empty");
486486

487487
final Map<String, Object> queryParameters = new HashMap<String, Object>();
488488
final JsonObject contentJson = new JsonObject();
@@ -583,7 +583,7 @@ public Concepts getDocumentRelatedConcepts(final Document document,
583583
*/
584584
public Scores getDocumentRelationScores(final Document document, final List<Concept> concepts) {
585585
final String documentId = IDHelper.getDocumentId(document);
586-
Validate.notEmpty(concepts, "concepts cannot be empty");
586+
Validator.notEmpty(concepts, "concepts cannot be empty");
587587

588588
final Map<String, Object> queryParams = new HashMap<String, Object>();
589589
final JsonObject contentJson = new JsonObject();
@@ -617,7 +617,7 @@ public Scores getDocumentRelationScores(final Document document, final List<Conc
617617
public Concepts getGraphRelatedConcepts(final Graph graph, final List<Concept> concepts,
618618
final Map<String, Object> parameters) {
619619
final String graphId = IDHelper.getGraphId(graph, getFirstAccountId());
620-
Validate.notEmpty(concepts, "concepts cannot be empty");
620+
Validator.notEmpty(concepts, "concepts cannot be empty");
621621

622622
final Map<String, Object> queryParameters = new HashMap<String, Object>();
623623
final String[] queryParms = new String[] {LEVEL, LIMIT};
@@ -663,7 +663,7 @@ private String toJson(Object object) {
663663
*/
664664
public Scores getGraphRelationScores(final Concept concept, final List<String> concepts) {
665665
final String conceptId = IDHelper.getConceptId(concept);
666-
Validate.notEmpty(concepts, "concepts cannot be empty");
666+
Validator.notEmpty(concepts, "concepts cannot be empty");
667667

668668
final Map<String, Object> queryParameters = new HashMap<String, Object>();
669669
final JsonObject contentJson = new JsonObject();
@@ -695,7 +695,7 @@ public Corpora listCorpora() {
695695
* @return {@link Corpora}
696696
*/
697697
public Corpora listCorpora(final String accountId) {
698-
Validate.notEmpty(accountId, "account_id cannot be empty");
698+
Validator.notEmpty(accountId, "account_id cannot be empty");
699699
return executeRequest(CORPORA_PATH + FORWARD_SLASH + accountId, null, Corpora.class);
700700
}
701701

@@ -778,7 +778,7 @@ public Graphs listGraphs() {
778778
*/
779779
public Matches searchCorpusByLabel(final Corpus corpus, final Map<String, Object> parameters) {
780780
final String corpusId = IDHelper.getCorpusId(corpus, getFirstAccountId());
781-
Validate.notEmpty((String) parameters.get(QUERY), "query cannot be empty");
781+
Validator.notEmpty((String) parameters.get(QUERY), "query cannot be empty");
782782

783783
final Map<String, Object> queryParameters = new HashMap<String, Object>();
784784
final String[] queryParams = new String[] {QUERY, PREFIX, LIMIT, CONCEPTS};
@@ -822,7 +822,7 @@ public Matches searchCorpusByLabel(final Corpus corpus, final Map<String, Object
822822
public Matches searchGraphsConceptByLabel(final Graph graph,
823823
final Map<String, Object> parameters) {
824824
final String graphId = IDHelper.getGraphId(graph, getFirstAccountId());
825-
Validate.notEmpty((String) parameters.get(QUERY), "query cannot be empty");
825+
Validator.notEmpty((String) parameters.get(QUERY), "query cannot be empty");
826826

827827
final Map<String, Object> queryParameters = new HashMap<String, Object>();
828828
final String[] params = new String[] {QUERY, PREFIX, LIMIT};

src/main/java/com/ibm/watson/developer_cloud/concept_insights/v2/model/AccountPermission.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ public enum Permission {
2929

3030
@SerializedName("Admin") ADMIN,
3131

32-
@SerializedName("ReadWriteAdmin") READ_WRITE_ADMIN;
32+
@SerializedName("ReadWriteAdmin") READ_WRITE_ADMIN
3333

3434
}
3535

src/main/java/com/ibm/watson/developer_cloud/concept_insights/v2/model/Concept.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
import com.google.gson.annotations.SerializedName;
1919
import com.ibm.watson.developer_cloud.concept_insights.v2.ConceptInsights;
2020
import com.ibm.watson.developer_cloud.service.model.GenericModel;
21-
import com.ibm.watson.developer_cloud.util.Validate;
21+
import com.ibm.watson.developer_cloud.util.Validator;
2222

2323
/**
2424
* Concept returned by the {@link ConceptInsights} service.
@@ -56,8 +56,8 @@ public Concept() {}
5656
* @param concept the concept
5757
*/
5858
public Concept(final Graph graph, final String concept) {
59-
Validate.notNull(graph, "graph cannot be null");
60-
Validate.notNull(graph.getId(), "graph.id cannot be null");
59+
Validator.notNull(graph, "graph cannot be null");
60+
Validator.notNull(graph.getId(), "graph.id cannot be null");
6161
setName(concept);
6262
setId(graph.getId() + "/concepts/" + concept);
6363
}
@@ -70,7 +70,7 @@ public Concept(final Graph graph, final String concept) {
7070
* @param concept the concept
7171
*/
7272
public Concept(final String accountId, final String graphName, final String concept) {
73-
Validate.notNull(concept, "concept cannot be null");
73+
Validator.notNull(concept, "concept cannot be null");
7474
setName(concept);
7575
setId(new Graph(accountId, graphName).getId() + "/concepts/" + concept);
7676
}

src/main/java/com/ibm/watson/developer_cloud/concept_insights/v2/model/Corpus.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
import com.google.gson.annotations.SerializedName;
2020
import com.ibm.watson.developer_cloud.concept_insights.v2.ConceptInsights;
2121
import com.ibm.watson.developer_cloud.service.model.GenericModel;
22-
import com.ibm.watson.developer_cloud.util.Validate;
22+
import com.ibm.watson.developer_cloud.util.Validator;
2323

2424
/**
2525
* Graphs returned by the {@link ConceptInsights} service.
@@ -108,8 +108,8 @@ public Corpus() {}
108108
* @param name the corpus name
109109
*/
110110
public Corpus(String accountId, String name) {
111-
Validate.notEmpty(accountId, "accountId cannot be empty");
112-
Validate.notEmpty(name, "name cannot be empty");
111+
Validator.notEmpty(accountId, "accountId cannot be empty");
112+
Validator.notEmpty(name, "name cannot be empty");
113113
setName(name);
114114
setId("/corpora/" + accountId + "/" + name);
115115
}

src/main/java/com/ibm/watson/developer_cloud/concept_insights/v2/model/Document.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
import com.google.gson.annotations.SerializedName;
2222
import com.ibm.watson.developer_cloud.concept_insights.v2.ConceptInsights;
2323
import com.ibm.watson.developer_cloud.service.model.GenericModel;
24-
import com.ibm.watson.developer_cloud.util.Validate;
24+
import com.ibm.watson.developer_cloud.util.Validator;
2525

2626
/**
2727
* Document returned by the {@link ConceptInsights} service.
@@ -67,8 +67,8 @@ public Document() {}
6767
* @param document the document
6868
*/
6969
public Document(final Corpus corpus, final String document) {
70-
Validate.notNull(corpus, "corpus cannot be null");
71-
Validate.notEmpty(corpus.getId(), "corpus.id cannot be empty");
70+
Validator.notNull(corpus, "corpus cannot be null");
71+
Validator.notEmpty(corpus.getId(), "corpus.id cannot be empty");
7272
setName(document);
7373
setId(corpus.getId() + "/documents/" + document);
7474
}
@@ -81,7 +81,7 @@ public Document(final Corpus corpus, final String document) {
8181
* @param document the document
8282
*/
8383
public Document(final String accountId, final String corpusName, final String document) {
84-
Validate.notEmpty(document, "document cannot be empty");
84+
Validator.notEmpty(document, "document cannot be empty");
8585
setName(document);
8686
setId(new Corpus(accountId, corpusName).getId() + "/documents/" + document);
8787
}

src/main/java/com/ibm/watson/developer_cloud/concept_insights/v2/model/Graph.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616
import com.ibm.watson.developer_cloud.concept_insights.v2.ConceptInsights;
1717
import com.ibm.watson.developer_cloud.service.model.GenericModel;
18-
import com.ibm.watson.developer_cloud.util.Validate;
18+
import com.ibm.watson.developer_cloud.util.Validator;
1919

2020
/**
2121
* Graph returned by the {@link ConceptInsights} service.
@@ -44,8 +44,8 @@ public Graph() {}
4444
* @param name the name
4545
*/
4646
public Graph(String accountId, String name) {
47-
Validate.notEmpty(accountId, "accountId cannot be empty");
48-
Validate.notEmpty(name, "name cannot be empty");
47+
Validator.notEmpty(accountId, "accountId cannot be empty");
48+
Validator.notEmpty(name, "name cannot be empty");
4949
setName(name);
5050
setId("/graphs/" + accountId + "/" + name);
5151
}

0 commit comments

Comments
 (0)