From bb3d01ec5ed20b70cce42f9b85797fff0b916dca Mon Sep 17 00:00:00 2001 From: Marco Ziccardi Date: Mon, 8 Aug 2016 10:31:19 +0200 Subject: [PATCH 1/2] Add Translate SPI layer --- gcloud-java-translate/pom.xml | 61 ++++++ .../com/google/cloud/translate/Translate.java | 27 +++ .../cloud/translate/TranslateException.java | 63 ++++++ .../cloud/translate/TranslateFactory.java | 25 +++ .../cloud/translate/TranslateOptions.java | 187 ++++++++++++++++++ .../translate/spi/DefaultTranslateRpc.java | 112 +++++++++++ .../cloud/translate/spi/TranslateRpc.java | 76 +++++++ .../translate/spi/TranslateRpcFactory.java | 27 +++ .../translate/TranslateExceptionTest.java | 105 ++++++++++ gcloud-java/pom.xml | 5 + pom.xml | 1 + 11 files changed, 689 insertions(+) create mode 100644 gcloud-java-translate/pom.xml create mode 100644 gcloud-java-translate/src/main/java/com/google/cloud/translate/Translate.java create mode 100644 gcloud-java-translate/src/main/java/com/google/cloud/translate/TranslateException.java create mode 100644 gcloud-java-translate/src/main/java/com/google/cloud/translate/TranslateFactory.java create mode 100644 gcloud-java-translate/src/main/java/com/google/cloud/translate/TranslateOptions.java create mode 100644 gcloud-java-translate/src/main/java/com/google/cloud/translate/spi/DefaultTranslateRpc.java create mode 100644 gcloud-java-translate/src/main/java/com/google/cloud/translate/spi/TranslateRpc.java create mode 100644 gcloud-java-translate/src/main/java/com/google/cloud/translate/spi/TranslateRpcFactory.java create mode 100644 gcloud-java-translate/src/test/java/com/google/cloud/translate/TranslateExceptionTest.java diff --git a/gcloud-java-translate/pom.xml b/gcloud-java-translate/pom.xml new file mode 100644 index 000000000000..f7c3c55e58f0 --- /dev/null +++ b/gcloud-java-translate/pom.xml @@ -0,0 +1,61 @@ + + + 4.0.0 + gcloud-java-translate + jar + GCloud Java translate + https://github.com/GoogleCloudPlatform/gcloud-java/tree/master/gcloud-java-translate + + Java idiomatic client for Google Translate. + + + com.google.cloud + gcloud-java-pom + 0.2.7-SNAPSHOT + + + gcloud-java-translate + + + + ${project.groupId} + gcloud-java-core + ${project.version} + + + com.google.apis + google-api-services-translate + v2-rev47-1.22.0 + compile + + + com.google.guava + guava-jdk5 + + + com.google.api-client + google-api-client + + + + + ${project.groupId} + gcloud-java-core + ${project.version} + test-jar + test + + + junit + junit + 4.12 + test + + + org.easymock + easymock + 3.4 + test + + + diff --git a/gcloud-java-translate/src/main/java/com/google/cloud/translate/Translate.java b/gcloud-java-translate/src/main/java/com/google/cloud/translate/Translate.java new file mode 100644 index 000000000000..1b1a3b9b12be --- /dev/null +++ b/gcloud-java-translate/src/main/java/com/google/cloud/translate/Translate.java @@ -0,0 +1,27 @@ +/* + * Copyright 2016 Google Inc. All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.translate; + +import com.google.cloud.Service; + +/** + * An interface for Google Translate. + * + * @see Google Translate + */ +public interface Translate extends Service { +} diff --git a/gcloud-java-translate/src/main/java/com/google/cloud/translate/TranslateException.java b/gcloud-java-translate/src/main/java/com/google/cloud/translate/TranslateException.java new file mode 100644 index 000000000000..f1d3c18fed8e --- /dev/null +++ b/gcloud-java-translate/src/main/java/com/google/cloud/translate/TranslateException.java @@ -0,0 +1,63 @@ +/* + * Copyright 2016 Google Inc. All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.translate; + +import com.google.cloud.BaseServiceException; +import com.google.cloud.RetryHelper.RetryHelperException; +import com.google.cloud.RetryHelper.RetryInterruptedException; +import com.google.common.collect.ImmutableSet; + +import java.io.IOException; +import java.util.Set; + +/** + * Google Translate service exception. + */ +public class TranslateException extends BaseServiceException { + + private static final Set RETRYABLE_ERRORS = ImmutableSet.of(new Error(500, null)); + private static final long serialVersionUID = 4747004866996469418L; + + TranslateException(int code, String message) { + super(code, message, null, true, null); + } + + TranslateException(int code, String message, Throwable cause) { + super(code, message, null, true, cause); + } + + public TranslateException(IOException exception) { + super(exception, true); + } + + @Override + protected Set retryableErrors() { + return RETRYABLE_ERRORS; + } + + /** + * Translate RetryHelperException to the TranslateException that caused the error. This method + * will always throw an exception. + * + * @throws TranslateException when {@code ex} was caused by a {@code TranslateException} + * @throws RetryInterruptedException when {@code ex} is a {@code RetryInterruptedException} + */ + static BaseServiceException translateAndThrow(RetryHelperException ex) { + BaseServiceException.translateAndPropagateIfPossible(ex); + throw new TranslateException(UNKNOWN_CODE, ex.getMessage(), ex.getCause()); + } +} diff --git a/gcloud-java-translate/src/main/java/com/google/cloud/translate/TranslateFactory.java b/gcloud-java-translate/src/main/java/com/google/cloud/translate/TranslateFactory.java new file mode 100644 index 000000000000..8c31c5505bd3 --- /dev/null +++ b/gcloud-java-translate/src/main/java/com/google/cloud/translate/TranslateFactory.java @@ -0,0 +1,25 @@ +/* + * Copyright 2016 Google Inc. All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.translate; + +import com.google.cloud.ServiceFactory; + +/** + * An interface for Translates factories. + */ +public interface TranslateFactory extends ServiceFactory { +} diff --git a/gcloud-java-translate/src/main/java/com/google/cloud/translate/TranslateOptions.java b/gcloud-java-translate/src/main/java/com/google/cloud/translate/TranslateOptions.java new file mode 100644 index 000000000000..744eeda9ffd8 --- /dev/null +++ b/gcloud-java-translate/src/main/java/com/google/cloud/translate/TranslateOptions.java @@ -0,0 +1,187 @@ +/* + * Copyright 2016 Google Inc. All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.translate; + +import static com.google.common.base.MoreObjects.firstNonNull; + +import com.google.cloud.AuthCredentials; +import com.google.cloud.HttpServiceOptions; +import com.google.cloud.translate.spi.DefaultTranslateRpc; +import com.google.cloud.translate.spi.TranslateRpc; +import com.google.cloud.translate.spi.TranslateRpcFactory; +import com.google.common.collect.ImmutableSet; + +import java.util.Locale; +import java.util.Set; + +public class TranslateOptions extends + HttpServiceOptions { + + private static final long serialVersionUID = 5997441123713672886L; + private static final Set SCOPES = ImmutableSet.of(); + + private final String apiKey; + private final String targetLanguage; + + public static class DefaultTranslateFactory implements TranslateFactory { + + private static final TranslateFactory INSTANCE = new DefaultTranslateFactory(); + + @Override + public Translate create(TranslateOptions options) { + return null; + //return new TranslateImpl(options); + } + } + + public static class DefaultTranslateRpcFactory implements TranslateRpcFactory { + + private static final TranslateRpcFactory INSTANCE = new DefaultTranslateRpcFactory(); + + @Override + public TranslateRpc create(TranslateOptions options) { + return new DefaultTranslateRpc(options); + } + } + + public static class Builder extends + HttpServiceOptions.Builder { + + private final String apiKey; + private String targetLanguage; + + private Builder(String apiKey) { + this.apiKey = apiKey; + } + + private Builder(TranslateOptions options) { + super(options); + this.apiKey = options.apiKey; + } + + /** + * Sets project id. Setting a project id has no impact on the {@link Translate} service. + * + * @return the builder + */ + @Override + public Builder projectId(String projectId) { + super.projectId(projectId); + return self(); + } + + /** + * Sets the service authentication credentials. Setting credentials has no impact on the + * {@link Translate} service. + * + * @return the builder + */ + public Builder authCredentials(AuthCredentials authCredentials) { + super.authCredentials(authCredentials); + return self(); + } + + /** + * Sets the code for the default target language. If not set, english ({@code en}) is used. + * + * @return the builder + */ + public Builder targetLanguage(String targetLanguage) { + this.targetLanguage = targetLanguage; + return self(); + } + + @Override + public TranslateOptions build() { + return new TranslateOptions(this); + } + } + + private TranslateOptions(Builder builder) { + super(TranslateFactory.class, TranslateRpcFactory.class, builder); + this.apiKey = builder.apiKey; + this.targetLanguage = firstNonNull(builder.targetLanguage, Locale.ENGLISH.getLanguage()); + } + + @Override + protected TranslateFactory defaultServiceFactory() { + return DefaultTranslateFactory.INSTANCE; + } + + @Override + protected TranslateRpcFactory defaultRpcFactory() { + return DefaultTranslateRpcFactory.INSTANCE; + } + + @Override + protected boolean projectIdRequired() { + return false; + } + + @Override + protected Set scopes() { + return SCOPES; + } + + /** + * Returns the API key, to be used used to send requests. + */ + public String apiKey() { + return apiKey; + } + + /** + * Returns the code for the default target language. + */ + public String targetLanguage() { + return targetLanguage; + } + + /** + * Returns a default {@code TranslateOptions} instance given an API key. For instructions on + * how to get an API key see Translate + * quickstart. + */ + public static TranslateOptions defaultInstance(String apiKey) { + return builder(apiKey).build(); + } + + @SuppressWarnings("unchecked") + @Override + public Builder toBuilder() { + return new Builder(this); + } + + @Override + public int hashCode() { + return baseHashCode(); + } + + @Override + public boolean equals(Object obj) { + return obj instanceof TranslateOptions && baseEquals((TranslateOptions) obj); + } + + /** + * Creates a builder for {@code TranslateOptions} objects given an api key. For instructions on + * how to get an API key see Translate + * quickstart. + */ + public static Builder builder(String apiKey) { + return new Builder(apiKey); + } +} diff --git a/gcloud-java-translate/src/main/java/com/google/cloud/translate/spi/DefaultTranslateRpc.java b/gcloud-java-translate/src/main/java/com/google/cloud/translate/spi/DefaultTranslateRpc.java new file mode 100644 index 000000000000..14f4a326399d --- /dev/null +++ b/gcloud-java-translate/src/main/java/com/google/cloud/translate/spi/DefaultTranslateRpc.java @@ -0,0 +1,112 @@ +/* + * Copyright 2016 Google Inc. All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.translate.spi; + +import static com.google.cloud.translate.spi.TranslateRpc.Option.SOURCE_LANGUAGE; +import static com.google.cloud.translate.spi.TranslateRpc.Option.TARGET_LANGUAGE; +import static com.google.common.base.MoreObjects.firstNonNull; + +import com.google.api.client.http.HttpRequestInitializer; +import com.google.api.client.http.HttpTransport; +import com.google.api.client.json.jackson.JacksonFactory; +import com.google.api.services.translate.Translate; +import com.google.api.services.translate.model.DetectionsResourceItems; +import com.google.api.services.translate.model.LanguagesResource; +import com.google.api.services.translate.model.TranslationsResource; +import com.google.cloud.translate.TranslateException; +import com.google.cloud.translate.TranslateOptions; +import com.google.common.base.Function; +import com.google.common.collect.ImmutableList; +import com.google.common.collect.Lists; + +import java.io.IOException; +import java.util.List; +import java.util.Map; + +public class DefaultTranslateRpc implements TranslateRpc { + + private final TranslateOptions options; + private final Translate translate; + + public DefaultTranslateRpc(TranslateOptions options) { + HttpTransport transport = options.httpTransportFactory().create(); + HttpRequestInitializer initializer = options.httpRequestInitializer(); + this.options = options; + translate = new Translate.Builder(transport, new JacksonFactory(), initializer) + .setRootUrl(options.host()) + .setApplicationName(options.applicationName()) + .build(); + } + + private static TranslateException translate(IOException exception) { + return new TranslateException(exception); + } + + @Override + public List> detect(List text) { + try { + List> detections = + translate.detections().list(text).setKey(options.apiKey()).execute().getDetections(); + return detections != null ? detections : ImmutableList.>of(); + } catch (IOException ex) { + throw translate(ex); + } + } + + @Override + public List listSupportedLanguages(Map optionMap) { + try { + List languages = translate.languages() + .list() + .setKey(options.apiKey()) + .setTarget(firstNonNull(TARGET_LANGUAGE.getString(optionMap), options.targetLanguage())) + .execute().getLanguages(); + return languages != null ? languages : ImmutableList.of(); + } catch (IOException ex) { + throw translate(ex); + } + } + + @Override + public List translate(List text, Map optionMap) { + try { + String targetLanguage = + firstNonNull(TARGET_LANGUAGE.getString(optionMap), options.targetLanguage()); + final String sourceLanguage = SOURCE_LANGUAGE.getString(optionMap); + List translations = + translate.translations() + .list(text, targetLanguage) + .setSource(sourceLanguage) + .setKey(options.apiKey()) + .execute() + .getTranslations(); + return Lists.transform( + translations != null ? translations : ImmutableList.of(), + new Function() { + @Override + public TranslationsResource apply(TranslationsResource translationsResource) { + if (translationsResource.getDetectedSourceLanguage() == null) { + translationsResource.setDetectedSourceLanguage(sourceLanguage); + } + return translationsResource; + } + }); + } catch (IOException ex) { + throw translate(ex); + } + } +} diff --git a/gcloud-java-translate/src/main/java/com/google/cloud/translate/spi/TranslateRpc.java b/gcloud-java-translate/src/main/java/com/google/cloud/translate/spi/TranslateRpc.java new file mode 100644 index 000000000000..5156bb7f1ac1 --- /dev/null +++ b/gcloud-java-translate/src/main/java/com/google/cloud/translate/spi/TranslateRpc.java @@ -0,0 +1,76 @@ +/* + * Copyright 2016 Google Inc. All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.translate.spi; + +import com.google.api.services.translate.model.DetectionsResourceItems; +import com.google.api.services.translate.model.LanguagesResource; +import com.google.api.services.translate.model.TranslationsResource; + +import java.util.List; +import java.util.Map; + +public interface TranslateRpc { + + enum Option { + SOURCE_LANGUAGE("source"), + TARGET_LANGUAGE("target"); + + private final String value; + + Option(String value) { + this.value = value; + } + + public String value() { + return value; + } + + @SuppressWarnings("unchecked") + T get(Map options) { + return (T) options.get(this); + } + + String getString(Map options) { + return get(options); + } + } + + /** + * Returns a list of the languages supported by Google Translate. + * + * @param optionMap options to listing language translations + */ + List listSupportedLanguages(Map optionMap); + + /** + * Detects the language of the provided texts. + * + * @param texts the texts to translate + * @return a list of lists of detections, one list of detections for each provided text, in order + */ + List> detect(List texts); + + /** + * Translates the provided texts. + * + * @param texts the texts to translate + * @param optionMap options to text translation + * @return a list of resources containing translation information, in the same order of the + * provided texts + */ + List translate(List texts, Map optionMap); +} diff --git a/gcloud-java-translate/src/main/java/com/google/cloud/translate/spi/TranslateRpcFactory.java b/gcloud-java-translate/src/main/java/com/google/cloud/translate/spi/TranslateRpcFactory.java new file mode 100644 index 000000000000..5ecf502e5306 --- /dev/null +++ b/gcloud-java-translate/src/main/java/com/google/cloud/translate/spi/TranslateRpcFactory.java @@ -0,0 +1,27 @@ +/* + * Copyright 2016 Google Inc. All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.translate.spi; + +import com.google.cloud.spi.ServiceRpcFactory; +import com.google.cloud.translate.TranslateOptions; + +/** + * An interface for Translate RPC factory. + * Implementation will be loaded via {@link java.util.ServiceLoader}. + */ +public interface TranslateRpcFactory extends ServiceRpcFactory { +} diff --git a/gcloud-java-translate/src/test/java/com/google/cloud/translate/TranslateExceptionTest.java b/gcloud-java-translate/src/test/java/com/google/cloud/translate/TranslateExceptionTest.java new file mode 100644 index 000000000000..13e2786ffe92 --- /dev/null +++ b/gcloud-java-translate/src/test/java/com/google/cloud/translate/TranslateExceptionTest.java @@ -0,0 +1,105 @@ +/* + * Copyright 2016 Google Inc. All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.translate; + +import static org.easymock.EasyMock.createMock; +import static org.easymock.EasyMock.expect; +import static org.easymock.EasyMock.replay; +import static org.easymock.EasyMock.verify; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertSame; +import static org.junit.Assert.assertTrue; + +import com.google.cloud.BaseServiceException; +import com.google.cloud.RetryHelper.RetryHelperException; + +import org.junit.Test; + +import java.io.IOException; +import java.net.SocketTimeoutException; + +public class TranslateExceptionTest { + + @Test + public void testTranslateException() { + TranslateException exception = new TranslateException(500, "message"); + assertEquals(500, exception.code()); + assertEquals("message", exception.getMessage()); + assertNull(exception.reason()); + assertTrue(exception.retryable()); + assertTrue(exception.idempotent()); + + exception = new TranslateException(400, "message"); + assertEquals(400, exception.code()); + assertEquals("message", exception.getMessage()); + assertNull(exception.reason()); + assertFalse(exception.retryable()); + assertTrue(exception.idempotent()); + + IOException cause = new SocketTimeoutException(); + exception = new TranslateException(cause); + assertNull(exception.reason()); + assertNull(exception.getMessage()); + assertTrue(exception.retryable()); + assertTrue(exception.idempotent()); + assertSame(cause, exception.getCause()); + + exception = new TranslateException(400, "message", cause); + assertEquals(400, exception.code()); + assertEquals("message", exception.getMessage()); + assertNull(exception.reason()); + assertFalse(exception.retryable()); + assertTrue(exception.idempotent()); + assertSame(cause, exception.getCause()); + } + + @Test + public void testTranslateAndThrow() throws Exception { + Exception cause = new TranslateException(500, "message"); + RetryHelperException exceptionMock = createMock(RetryHelperException.class); + expect(exceptionMock.getCause()).andReturn(cause).times(2); + replay(exceptionMock); + try { + TranslateException.translateAndThrow(exceptionMock); + } catch (BaseServiceException ex) { + assertEquals(500, ex.code()); + assertEquals("message", ex.getMessage()); + assertTrue(ex.retryable()); + assertTrue(ex.idempotent()); + } finally { + verify(exceptionMock); + } + cause = new IllegalArgumentException("message"); + exceptionMock = createMock(RetryHelperException.class); + expect(exceptionMock.getMessage()).andReturn("message").times(1); + expect(exceptionMock.getCause()).andReturn(cause).times(2); + replay(exceptionMock); + try { + TranslateException.translateAndThrow(exceptionMock); + } catch (BaseServiceException ex) { + assertEquals(TranslateException.UNKNOWN_CODE, ex.code()); + assertEquals("message", ex.getMessage()); + assertFalse(ex.retryable()); + assertTrue(ex.idempotent()); + assertSame(cause, ex.getCause()); + } finally { + verify(exceptionMock); + } + } +} diff --git a/gcloud-java/pom.xml b/gcloud-java/pom.xml index 7a9427ef313f..486802088722 100644 --- a/gcloud-java/pom.xml +++ b/gcloud-java/pom.xml @@ -59,5 +59,10 @@ gcloud-java-storage ${project.version} + + ${project.groupId} + gcloud-java-translate + ${project.version} + diff --git a/pom.xml b/pom.xml index 7b76805e40a2..05e0412d7abf 100644 --- a/pom.xml +++ b/pom.xml @@ -105,6 +105,7 @@ gcloud-java-pubsub gcloud-java-resourcemanager gcloud-java-storage + gcloud-java-translate From 8dfea2c49ce708476608918e4752db9e58b1b00a Mon Sep 17 00:00:00 2001 From: Marco Ziccardi Date: Wed, 10 Aug 2016 18:49:21 +0200 Subject: [PATCH 2/2] Add todo comment to DefaultTranslateFactory --- .../main/java/com/google/cloud/translate/TranslateOptions.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/gcloud-java-translate/src/main/java/com/google/cloud/translate/TranslateOptions.java b/gcloud-java-translate/src/main/java/com/google/cloud/translate/TranslateOptions.java index 744eeda9ffd8..599d4a1d389f 100644 --- a/gcloud-java-translate/src/main/java/com/google/cloud/translate/TranslateOptions.java +++ b/gcloud-java-translate/src/main/java/com/google/cloud/translate/TranslateOptions.java @@ -44,7 +44,8 @@ public static class DefaultTranslateFactory implements TranslateFactory { @Override public Translate create(TranslateOptions options) { return null; - //return new TranslateImpl(options); + // todo(mziccard) uncomment as soon as TranslateImpl is implemented + // return new TranslateImpl(options); } }