Skip to content

Commit 5b61fb1

Browse files
switch from LanguageModel to TranslationModel
1 parent bf9c2b5 commit 5b61fb1

File tree

2 files changed

+22
-23
lines changed

2 files changed

+22
-23
lines changed

src/main/java/com/ibm/watson/developer_cloud/language_translation/v2/LanguageTranslation.java

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
import com.google.gson.reflect.TypeToken;
3131
import com.ibm.watson.developer_cloud.language_translation.v2.model.IdentifiableLanguage;
3232
import com.ibm.watson.developer_cloud.language_translation.v2.model.IdentifiedLanguage;
33-
import com.ibm.watson.developer_cloud.language_translation.v2.model.LanguageModel;
33+
import com.ibm.watson.developer_cloud.language_translation.v2.model.TranslationModel;
3434
import com.ibm.watson.developer_cloud.language_translation.v2.model.TranslationResult;
3535
import com.ibm.watson.developer_cloud.service.Request;
3636
import com.ibm.watson.developer_cloud.service.WatsonService;
@@ -65,11 +65,11 @@ public class LanguageTranslation extends WatsonService {
6565
}.getType();
6666

6767
/** The language model list type. */
68-
private final Type languageModelListType = new TypeToken<List<IdentifiedLanguage>>() {
68+
private final Type translationModelListType = new TypeToken<List<IdentifiedLanguage>>() {
6969
}.getType();
7070

7171
/** The model list type. */
72-
private final Type modelListType = new TypeToken<List<LanguageModel>>() {
72+
private final Type modelListType = new TypeToken<List<TranslationModel>>() {
7373
}.getType();
7474

7575
/**
@@ -85,7 +85,7 @@ public LanguageTranslation() {
8585
* Retrieves the list of identifiable languages.
8686
*
8787
* @return the identifiable languages
88-
* @see LanguageModel
88+
* @see TranslationModel
8989
*/
9090
public List<IdentifiableLanguage> getIdentifiableLanguages() {
9191
Request request = Request.Get("/v2/identifiable_languages");
@@ -106,9 +106,9 @@ public List<IdentifiableLanguage> getIdentifiableLanguages() {
106106
* Retrieves the list of models.
107107
*
108108
* @return the translation models
109-
* @see LanguageModel
109+
* @see TranslationModel
110110
*/
111-
public List<LanguageModel> getModels() {
111+
public List<TranslationModel> getModels() {
112112
return getModels(null, null, null);
113113
}
114114

@@ -122,9 +122,9 @@ public List<LanguageModel> getModels() {
122122
* @param target
123123
* the target
124124
* @return the translation models
125-
* @see LanguageModel
125+
* @see TranslationModel
126126
*/
127-
public List<LanguageModel> getModels(final Boolean showDefault,
127+
public List<TranslationModel> getModels(final Boolean showDefault,
128128
final String source, final String target) {
129129
Request request = Request.Get("/v2/models");
130130

@@ -141,7 +141,7 @@ public List<LanguageModel> getModels(final Boolean showDefault,
141141
try {
142142
HttpResponse response = execute(requestBase);
143143
JsonObject jsonObject = ResponseUtil.getJsonObject(response);
144-
List<LanguageModel> models = getGson().fromJson(
144+
List<TranslationModel> models = getGson().fromJson(
145145
jsonObject.get("models"), modelListType);
146146
return models;
147147
} catch (IOException e) {
@@ -165,7 +165,7 @@ public List<IdentifiedLanguage> identify(final String text) {
165165
HttpResponse response = execute(request);
166166
JsonObject jsonObject = ResponseUtil.getJsonObject(response);
167167
List<IdentifiedLanguage> identifiedLanguages = getGson().fromJson(
168-
jsonObject.get(LANGUAGES), languageModelListType);
168+
jsonObject.get(LANGUAGES), translationModelListType);
169169
return identifiedLanguages;
170170
} catch (IOException e) {
171171
throw new RuntimeException(e);

src/main/java/com/ibm/watson/developer_cloud/language_translation/v2/model/LanguageModel.java renamed to src/main/java/com/ibm/watson/developer_cloud/language_translation/v2/model/TranslationModel.java

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,13 @@
22

33
import com.google.gson.GsonBuilder;
44
import com.google.gson.annotations.SerializedName;
5-
import com.ibm.watson.developer_cloud.language_translation.v2.LanguageTranslation;
65

76
/**
8-
* Language Model used by the {@link LanguageTranslation}.
7+
* Language Model used by the {@link TranslationModel}.
98
*
109
* @author German Attanasio Ruiz germanatt@us.ibm.com
1110
*/
12-
public class LanguageModel {
11+
public class TranslationModel {
1312

1413
/** The model id. */
1514
@SerializedName("model_id")
@@ -70,7 +69,7 @@ public void setModelId(final String modelId) {
7069
* the model id
7170
* @return the language model set
7271
*/
73-
public LanguageModel withModelId(final String modelId) {
72+
public TranslationModel withModelId(final String modelId) {
7473
this.modelId = modelId;
7574
return this;
7675
}
@@ -101,7 +100,7 @@ public void setSource(final String source) {
101100
* the source
102101
* @return the language model set
103102
*/
104-
public LanguageModel withSource(final String source) {
103+
public TranslationModel withSource(final String source) {
105104
this.source = source;
106105
return this;
107106
}
@@ -132,7 +131,7 @@ public void setTarget(final String target) {
132131
* the target
133132
* @return the language model set
134133
*/
135-
public LanguageModel withTarget(final String target) {
134+
public TranslationModel withTarget(final String target) {
136135
this.target = target;
137136
return this;
138137
}
@@ -163,7 +162,7 @@ public void setBaseModelId(final String baseModelId) {
163162
* the base model id
164163
* @return the language model set
165164
*/
166-
public LanguageModel withBaseModelId(final String baseModelId) {
165+
public TranslationModel withBaseModelId(final String baseModelId) {
167166
this.baseModelId = baseModelId;
168167
return this;
169168
}
@@ -194,7 +193,7 @@ public void setDomain(final String domain) {
194193
* the domain
195194
* @return the language model set
196195
*/
197-
public LanguageModel withDomain(final String domain) {
196+
public TranslationModel withDomain(final String domain) {
198197
this.domain = domain;
199198
return this;
200199
}
@@ -225,7 +224,7 @@ public void setCustomizable(final boolean customizable) {
225224
* the customizable
226225
* @return the language model set
227226
*/
228-
public LanguageModel withCustomizable(final boolean customizable) {
227+
public TranslationModel withCustomizable(final boolean customizable) {
229228
this.customizable = customizable;
230229
return this;
231230
}
@@ -256,7 +255,7 @@ public void setDefaultModel(final boolean defaultModel) {
256255
* the default model
257256
* @return the language model set
258257
*/
259-
public LanguageModel withDefaultModel(final boolean defaultModel) {
258+
public TranslationModel withDefaultModel(final boolean defaultModel) {
260259
this.defaultModel = defaultModel;
261260
return this;
262261
}
@@ -287,7 +286,7 @@ public void setOwner(final String owner) {
287286
* the owner
288287
* @return the language model set
289288
*/
290-
public LanguageModel withOwner(final String owner) {
289+
public TranslationModel withOwner(final String owner) {
291290
this.owner = owner;
292291
return this;
293292
}
@@ -318,7 +317,7 @@ public void setStatus(final String status) {
318317
* the status
319318
* @return the language model set
320319
*/
321-
public LanguageModel withStatus(final String status) {
320+
public TranslationModel withStatus(final String status) {
322321
this.status = status;
323322
return this;
324323
}
@@ -349,7 +348,7 @@ public void setName(final String name) {
349348
* the name
350349
* @return the language model set
351350
*/
352-
public LanguageModel withName(final String name) {
351+
public TranslationModel withName(final String name) {
353352
this.name = name;
354353
return this;
355354
}

0 commit comments

Comments
 (0)