/** * * * <pre> * The enabled features. * </pre> * * <code>.google.cloud.language.v1.AnnotateTextRequest.Features features = 2;</code> */ public Builder mergeFeatures(com.google.cloud.language.v1.AnnotateTextRequest.Features value) { if (featuresBuilder_ == null) { if (features_ != null) { features_ = com.google.cloud.language.v1.AnnotateTextRequest.Features.newBuilder(features_) .mergeFrom(value) .buildPartial(); } else { features_ = value; } onChanged(); } else { featuresBuilder_.mergeFrom(value); } return this; } /**
@java.lang.Override public boolean equals(final java.lang.Object obj) { if (obj == this) { return true; } if (!(obj instanceof com.google.cloud.language.v1.AnnotateTextRequest)) { return super.equals(obj); } com.google.cloud.language.v1.AnnotateTextRequest other = (com.google.cloud.language.v1.AnnotateTextRequest) obj; boolean result = true; result = result && (hasDocument() == other.hasDocument()); if (hasDocument()) { result = result && getDocument().equals(other.getDocument()); } result = result && (hasFeatures() == other.hasFeatures()); if (hasFeatures()) { result = result && getFeatures().equals(other.getFeatures()); } result = result && encodingType_ == other.encodingType_; result = result && unknownFields.equals(other.unknownFields); return result; }
@java.lang.Override public boolean equals(final java.lang.Object obj) { if (obj == this) { return true; } if (!(obj instanceof com.google.cloud.language.v1.AnnotateTextRequest.Features)) { return super.equals(obj); } com.google.cloud.language.v1.AnnotateTextRequest.Features other = (com.google.cloud.language.v1.AnnotateTextRequest.Features) obj; boolean result = true; result = result && (getExtractSyntax() == other.getExtractSyntax()); result = result && (getExtractEntities() == other.getExtractEntities()); result = result && (getExtractDocumentSentiment() == other.getExtractDocumentSentiment()); result = result && (getExtractEntitySentiment() == other.getExtractEntitySentiment()); result = result && (getClassifyText() == other.getClassifyText()); result = result && unknownFields.equals(other.unknownFields); return result; }
/** * * * <pre> * The enabled features. * </pre> * * <code>.google.cloud.language.v1.AnnotateTextRequest.Features features = 2;</code> */ public Builder mergeFeatures(com.google.cloud.language.v1.AnnotateTextRequest.Features value) { if (featuresBuilder_ == null) { if (features_ != null) { features_ = com.google.cloud.language.v1.AnnotateTextRequest.Features.newBuilder(features_) .mergeFrom(value) .buildPartial(); } else { features_ = value; } onChanged(); } else { featuresBuilder_.mergeFrom(value); } return this; } /**
@java.lang.Override public boolean equals(final java.lang.Object obj) { if (obj == this) { return true; } if (!(obj instanceof com.google.cloud.language.v1.AnnotateTextRequest)) { return super.equals(obj); } com.google.cloud.language.v1.AnnotateTextRequest other = (com.google.cloud.language.v1.AnnotateTextRequest) obj; boolean result = true; result = result && (hasDocument() == other.hasDocument()); if (hasDocument()) { result = result && getDocument().equals(other.getDocument()); } result = result && (hasFeatures() == other.hasFeatures()); if (hasFeatures()) { result = result && getFeatures().equals(other.getFeatures()); } result = result && encodingType_ == other.encodingType_; result = result && unknownFields.equals(other.unknownFields); return result; }
/** * * * <pre> * The enabled features. * </pre> * * <code>.google.cloud.language.v1.AnnotateTextRequest.Features features = 2;</code> */ public com.google.cloud.language.v1.AnnotateTextRequest.FeaturesOrBuilder getFeaturesOrBuilder() { if (featuresBuilder_ != null) { return featuresBuilder_.getMessageOrBuilder(); } else { return features_ == null ? com.google.cloud.language.v1.AnnotateTextRequest.Features.getDefaultInstance() : features_; } } /**
@java.lang.Override public int hashCode() { if (memoizedHashCode != 0) { return memoizedHashCode; } int hash = 41; hash = (19 * hash) + getDescriptor().hashCode(); hash = (37 * hash) + EXTRACT_SYNTAX_FIELD_NUMBER; hash = (53 * hash) + com.google.protobuf.Internal.hashBoolean(getExtractSyntax()); hash = (37 * hash) + EXTRACT_ENTITIES_FIELD_NUMBER; hash = (53 * hash) + com.google.protobuf.Internal.hashBoolean(getExtractEntities()); hash = (37 * hash) + EXTRACT_DOCUMENT_SENTIMENT_FIELD_NUMBER; hash = (53 * hash) + com.google.protobuf.Internal.hashBoolean(getExtractDocumentSentiment()); hash = (37 * hash) + EXTRACT_ENTITY_SENTIMENT_FIELD_NUMBER; hash = (53 * hash) + com.google.protobuf.Internal.hashBoolean(getExtractEntitySentiment()); hash = (37 * hash) + CLASSIFY_TEXT_FIELD_NUMBER; hash = (53 * hash) + com.google.protobuf.Internal.hashBoolean(getClassifyText()); hash = (29 * hash) + unknownFields.hashCode(); memoizedHashCode = hash; return hash; }
public Builder mergeFrom(com.google.cloud.language.v1.AnnotateTextRequest.Features other) { if (other == com.google.cloud.language.v1.AnnotateTextRequest.Features.getDefaultInstance()) return this; if (other.getExtractSyntax() != false) { setExtractSyntax(other.getExtractSyntax()); } if (other.getExtractEntities() != false) { setExtractEntities(other.getExtractEntities()); } if (other.getExtractDocumentSentiment() != false) { setExtractDocumentSentiment(other.getExtractDocumentSentiment()); } if (other.getExtractEntitySentiment() != false) { setExtractEntitySentiment(other.getExtractEntitySentiment()); } if (other.getClassifyText() != false) { setClassifyText(other.getClassifyText()); } this.mergeUnknownFields(other.unknownFields); onChanged(); return this; }
@java.lang.Override public boolean equals(final java.lang.Object obj) { if (obj == this) { return true; } if (!(obj instanceof com.google.cloud.language.v1.AnnotateTextRequest.Features)) { return super.equals(obj); } com.google.cloud.language.v1.AnnotateTextRequest.Features other = (com.google.cloud.language.v1.AnnotateTextRequest.Features) obj; boolean result = true; result = result && (getExtractSyntax() == other.getExtractSyntax()); result = result && (getExtractEntities() == other.getExtractEntities()); result = result && (getExtractDocumentSentiment() == other.getExtractDocumentSentiment()); result = result && (getExtractEntitySentiment() == other.getExtractEntitySentiment()); result = result && (getClassifyText() == other.getClassifyText()); result = result && unknownFields.equals(other.unknownFields); return result; }
/** * * * <pre> * The enabled features. * </pre> * * <code>.google.cloud.language.v1.AnnotateTextRequest.Features features = 2;</code> */ public com.google.cloud.language.v1.AnnotateTextRequest.Features getFeatures() { if (featuresBuilder_ == null) { return features_ == null ? com.google.cloud.language.v1.AnnotateTextRequest.Features.getDefaultInstance() : features_; } else { return featuresBuilder_.getMessage(); } } /**
/** * * * <pre> * The enabled features. * </pre> * * <code>.google.cloud.language.v1.AnnotateTextRequest.Features features = 2;</code> */ public com.google.cloud.language.v1.AnnotateTextRequest.Features getFeatures() { return features_ == null ? com.google.cloud.language.v1.AnnotateTextRequest.Features.getDefaultInstance() : features_; } /**
@java.lang.Override public Builder newBuilderForType() { return newBuilder(); }
@java.lang.Override public com.google.cloud.language.v1.AnnotateTextRequest.Features getDefaultInstanceForType() { return com.google.cloud.language.v1.AnnotateTextRequest.Features.getDefaultInstance(); }
@java.lang.Override public com.google.cloud.language.v1.AnnotateTextRequest.Features buildPartial() { com.google.cloud.language.v1.AnnotateTextRequest.Features result = new com.google.cloud.language.v1.AnnotateTextRequest.Features(this); result.extractSyntax_ = extractSyntax_; result.extractEntities_ = extractEntities_; result.extractDocumentSentiment_ = extractDocumentSentiment_; result.extractEntitySentiment_ = extractEntitySentiment_; result.classifyText_ = classifyText_; onBuilt(); return result; }
@Test @SuppressWarnings("all") public void annotateTextTest() { String language = "language-1613589672"; AnnotateTextResponse expectedResponse = AnnotateTextResponse.newBuilder().setLanguage(language).build(); mockLanguageService.addResponse(expectedResponse); Document document = Document.newBuilder().build(); AnnotateTextRequest.Features features = AnnotateTextRequest.Features.newBuilder().build(); EncodingType encodingType = EncodingType.NONE; AnnotateTextResponse actualResponse = client.annotateText(document, features, encodingType); Assert.assertEquals(expectedResponse, actualResponse); List<GeneratedMessageV3> actualRequests = mockLanguageService.getRequests(); Assert.assertEquals(1, actualRequests.size()); AnnotateTextRequest actualRequest = (AnnotateTextRequest) actualRequests.get(0); Assert.assertEquals(document, actualRequest.getDocument()); Assert.assertEquals(features, actualRequest.getFeatures()); Assert.assertEquals(encodingType, actualRequest.getEncodingType()); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); }
/** * * * <pre> * The enabled features. * </pre> * * <code>.google.cloud.language.v1.AnnotateTextRequest.Features features = 2;</code> */ public com.google.cloud.language.v1.AnnotateTextRequest.FeaturesOrBuilder getFeaturesOrBuilder() { if (featuresBuilder_ != null) { return featuresBuilder_.getMessageOrBuilder(); } else { return features_ == null ? com.google.cloud.language.v1.AnnotateTextRequest.Features.getDefaultInstance() : features_; } } /**
public Builder mergeFrom(com.google.cloud.language.v1.AnnotateTextRequest.Features other) { if (other == com.google.cloud.language.v1.AnnotateTextRequest.Features.getDefaultInstance()) return this; if (other.getExtractSyntax() != false) { setExtractSyntax(other.getExtractSyntax()); } if (other.getExtractEntities() != false) { setExtractEntities(other.getExtractEntities()); } if (other.getExtractDocumentSentiment() != false) { setExtractDocumentSentiment(other.getExtractDocumentSentiment()); } if (other.getExtractEntitySentiment() != false) { setExtractEntitySentiment(other.getExtractEntitySentiment()); } if (other.getClassifyText() != false) { setClassifyText(other.getClassifyText()); } this.mergeUnknownFields(other.unknownFields); onChanged(); return this; }
/** * * * <pre> * The enabled features. * </pre> * * <code>.google.cloud.language.v1.AnnotateTextRequest.Features features = 2;</code> */ public com.google.cloud.language.v1.AnnotateTextRequest.Features getFeatures() { if (featuresBuilder_ == null) { return features_ == null ? com.google.cloud.language.v1.AnnotateTextRequest.Features.getDefaultInstance() : features_; } else { return featuresBuilder_.getMessage(); } } /**
@java.lang.Override public int hashCode() { if (memoizedHashCode != 0) { return memoizedHashCode; } int hash = 41; hash = (19 * hash) + getDescriptor().hashCode(); hash = (37 * hash) + EXTRACT_SYNTAX_FIELD_NUMBER; hash = (53 * hash) + com.google.protobuf.Internal.hashBoolean(getExtractSyntax()); hash = (37 * hash) + EXTRACT_ENTITIES_FIELD_NUMBER; hash = (53 * hash) + com.google.protobuf.Internal.hashBoolean(getExtractEntities()); hash = (37 * hash) + EXTRACT_DOCUMENT_SENTIMENT_FIELD_NUMBER; hash = (53 * hash) + com.google.protobuf.Internal.hashBoolean(getExtractDocumentSentiment()); hash = (37 * hash) + EXTRACT_ENTITY_SENTIMENT_FIELD_NUMBER; hash = (53 * hash) + com.google.protobuf.Internal.hashBoolean(getExtractEntitySentiment()); hash = (37 * hash) + CLASSIFY_TEXT_FIELD_NUMBER; hash = (53 * hash) + com.google.protobuf.Internal.hashBoolean(getClassifyText()); hash = (29 * hash) + unknownFields.hashCode(); memoizedHashCode = hash; return hash; }
@Test @SuppressWarnings("all") public void annotateTextExceptionTest() throws Exception { StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); mockLanguageService.addException(exception); try { Document document = Document.newBuilder().build(); AnnotateTextRequest.Features features = AnnotateTextRequest.Features.newBuilder().build(); EncodingType encodingType = EncodingType.NONE; client.annotateText(document, features, encodingType); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception } } }