Skip to content

Commit 189f611

Browse files
author
Yaison
committed
WS-2589: marking genre as deprecated.
1 parent 60e50aa commit 189f611

File tree

4 files changed

+75
-42
lines changed

4 files changed

+75
-42
lines changed

json/src/main/java/com/basistech/rosette/apimodel/jackson/AdmRequestMixin.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ protected AdmRequestMixin(
3636
@JsonProperty("profileId") String profileId,
3737
@JsonProperty("text") AnnotatedText text,
3838
@JsonProperty("options") Options options,
39-
@JsonProperty("genre") String genre,
39+
@Deprecated @JsonProperty("genre") String genre,
4040
@JsonProperty("language") LanguageCode language
4141
) {
4242
//

json/src/main/java/com/basistech/rosette/apimodel/jackson/DocumentRequestMixin.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ protected DocumentRequestMixin(
4747
@JsonProperty("content") Object content,
4848
@JsonProperty("contentUri") String contentUri,
4949
@JsonProperty("contentType") String contentType,
50-
@JsonProperty("genre") String genre,
50+
@Deprecated @JsonProperty("genre") String genre,
5151
@JsonProperty("options") Options options
5252
) {
5353
//

model/src/main/java/com/basistech/rosette/apimodel/AdmRequest.java

Lines changed: 32 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
/*
2-
* Copyright 2017 Basis Technology Corp.
3-
*
4-
* Licensed under the Apache License, Version 2.0 (the "License");
5-
* you may not use this file except in compliance with the License.
6-
* You may obtain a copy of the License at
7-
*
8-
* http://www.apache.org/licenses/LICENSE-2.0
9-
*
10-
* Unless required by applicable law or agreed to in writing, software
11-
* distributed under the License is distributed on an "AS IS" BASIS,
12-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13-
* See the License for the specific language governing permissions and
14-
* limitations under the License.
15-
*/
2+
* Copyright 2017 Basis Technology Corp.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
1616
package com.basistech.rosette.apimodel;
1717

1818
import com.basistech.rosette.dm.AnnotatedText;
@@ -39,6 +39,7 @@ public final class AdmRequest<O extends Options> extends Request {
3939
private final O options;
4040

4141
/**
42+
* @deprecated
4243
* @return genre
4344
*/
4445
private final String genre;
@@ -48,12 +49,25 @@ public final class AdmRequest<O extends Options> extends Request {
4849
*/
4950
private final LanguageCode language;
5051

52+
53+
public AdmRequest(String profileId,
54+
AnnotatedText text,
55+
O options,
56+
LanguageCode language) {
57+
super(profileId);
58+
this.text = text;
59+
this.options = options;
60+
this.genre = null;
61+
this.language = language;
62+
}
63+
64+
5165
@Builder // workaround for inheritance https://github.com/rzwitserloot/lombok/issues/853
5266
public AdmRequest(String profileId,
53-
AnnotatedText text,
54-
O options,
55-
String genre,
56-
LanguageCode language) {
67+
AnnotatedText text,
68+
O options,
69+
@Deprecated String genre,
70+
LanguageCode language) {
5771
super(profileId);
5872
this.text = text;
5973
this.options = options;

model/src/main/java/com/basistech/rosette/apimodel/DocumentRequest.java

Lines changed: 41 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
/*
2-
* Copyright 2017 Basis Technology Corp.
3-
*
4-
* Licensed under the Apache License, Version 2.0 (the "License");
5-
* you may not use this file except in compliance with the License.
6-
* You may obtain a copy of the License at
7-
*
8-
* http://www.apache.org/licenses/LICENSE-2.0
9-
*
10-
* Unless required by applicable law or agreed to in writing, software
11-
* distributed under the License is distributed on an "AS IS" BASIS,
12-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13-
* See the License for the specific language governing permissions and
14-
* limitations under the License.
15-
*/
2+
* Copyright 2017 Basis Technology Corp.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
1616

1717
package com.basistech.rosette.apimodel;
1818

@@ -44,9 +44,6 @@
4444
* In this object the 'content' item is an {@link Object}; it contains a {@link String}
4545
* for plain text, or an {@link java.io.InputStream} for binary data. {@link DocumentRequest.DocumentRequestBuilder}
4646
* provides several alternative methods for setting this information.
47-
*
48-
* This class includes a 'genre' field. If no genre is specified, then the system
49-
* applies generic processing. Valid values for genre are specified in the API documentation.
5047
*/
5148
@Value
5249
public final class DocumentRequest<O extends Options> extends Request {
@@ -71,7 +68,7 @@ public final class DocumentRequest<O extends Options> extends Request {
7168
*/
7269
private final String contentType;
7370

74-
/**
71+
/** @deprecated
7572
* @return request genre
7673
*/
7774
private final String genre;
@@ -81,13 +78,29 @@ public final class DocumentRequest<O extends Options> extends Request {
8178
*/
8279
private final O options;
8380

81+
82+
public DocumentRequest(String profileId,
83+
LanguageCode language,
84+
Object content,
85+
String contentUri,
86+
String contentType,
87+
O options) {
88+
super(profileId);
89+
this.language = language;
90+
this.content = content;
91+
this.contentUri = contentUri;
92+
this.contentType = contentType;
93+
this.genre = null;
94+
this.options = options;
95+
}
96+
8497
@Builder // workaround for inheritance https://github.com/rzwitserloot/lombok/issues/853
8598
public DocumentRequest(String profileId,
8699
LanguageCode language,
87100
Object content,
88101
String contentUri,
89102
String contentType,
90-
String genre,
103+
@Deprecated String genre,
91104
O options) {
92105
super(profileId);
93106
this.language = language;
@@ -100,6 +113,7 @@ public DocumentRequest(String profileId,
100113

101114
/**
102115
* get content to process if it's a String.
116+
*
103117
* @return the content if a String, else null.
104118
*/
105119
public String getContent() {
@@ -112,18 +126,20 @@ public String getContent() {
112126

113127
/**
114128
* get the content as an array of bytes
129+
*
115130
* @return the content as bytes
116131
*/
117132
public InputStream getContentBytes() {
118133
if (content instanceof InputStream) {
119-
return (InputStream)content;
134+
return (InputStream) content;
120135
} else {
121136
return null;
122137
}
123138
}
124139

125140
/**
126141
* get content as an object
142+
*
127143
* @return the content as object
128144
*/
129145
public Object getRawContent() {
@@ -134,6 +150,7 @@ public Object getRawContent() {
134150
public static class DocumentRequestBuilder<O extends Options> {
135151
/**
136152
* Specify the content as String. Use this for plain text.
153+
*
137154
* @param data The data.
138155
* @return this.
139156
*/
@@ -145,7 +162,8 @@ public DocumentRequestBuilder<O> content(String data) {
145162
/**
146163
* Specify the content as bytes with a content type. Use this for
147164
* formats other than plain text.
148-
* @param bytes The data.
165+
*
166+
* @param bytes The data.
149167
* @param contentType the content type.
150168
* @return this.
151169
*/
@@ -158,7 +176,8 @@ public DocumentRequestBuilder<O> content(byte[] bytes, String contentType) {
158176
/**
159177
* Specify the content as bytes with a content type. Use this for
160178
* formats other than plain text.
161-
* @param bytes The data.
179+
*
180+
* @param bytes The data.
162181
* @param contentType the content type.
163182
* @return this.
164183
*/

0 commit comments

Comments
 (0)