/** * * * <pre> * Input document. * </pre> * * <code>.google.cloud.language.v1.Document document = 1;</code> */ public com.google.cloud.language.v1.DocumentOrBuilder getDocumentOrBuilder() { return getDocument(); }
@java.lang.Override public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { if (document_ != null) { output.writeMessage(1, getDocument()); } if (encodingType_ != com.google.cloud.language.v1.EncodingType.NONE.getNumber()) { output.writeEnum(2, encodingType_); } unknownFields.writeTo(output); }
@java.lang.Override public int getSerializedSize() { int size = memoizedSize; if (size != -1) return size; size = 0; if (document_ != null) { size += com.google.protobuf.CodedOutputStream.computeMessageSize(1, getDocument()); } if (encodingType_ != com.google.cloud.language.v1.EncodingType.NONE.getNumber()) { size += com.google.protobuf.CodedOutputStream.computeEnumSize(2, encodingType_); } size += unknownFields.getSerializedSize(); memoizedSize = size; return size; }
@java.lang.Override public boolean equals(final java.lang.Object obj) { if (obj == this) { return true; } if (!(obj instanceof com.google.cloud.language.v1.AnalyzeSentimentRequest)) { return super.equals(obj); } com.google.cloud.language.v1.AnalyzeSentimentRequest other = (com.google.cloud.language.v1.AnalyzeSentimentRequest) obj; boolean result = true; result = result && (hasDocument() == other.hasDocument()); if (hasDocument()) { result = result && getDocument().equals(other.getDocument()); } result = result && encodingType_ == other.encodingType_; result = result && unknownFields.equals(other.unknownFields); return result; }
@java.lang.Override public int hashCode() { if (memoizedHashCode != 0) { return memoizedHashCode; } int hash = 41; hash = (19 * hash) + getDescriptor().hashCode(); if (hasDocument()) { hash = (37 * hash) + DOCUMENT_FIELD_NUMBER; hash = (53 * hash) + getDocument().hashCode(); } hash = (37 * hash) + ENCODING_TYPE_FIELD_NUMBER; hash = (53 * hash) + encodingType_; hash = (29 * hash) + unknownFields.hashCode(); memoizedHashCode = hash; return hash; }
public Builder mergeFrom(com.google.cloud.language.v1.AnalyzeSentimentRequest other) { if (other == com.google.cloud.language.v1.AnalyzeSentimentRequest.getDefaultInstance()) return this; if (other.hasDocument()) { mergeDocument(other.getDocument()); } if (other.encodingType_ != 0) { setEncodingTypeValue(other.getEncodingTypeValue()); } this.mergeUnknownFields(other.unknownFields); onChanged(); return this; }
@Test @SuppressWarnings("all") public void analyzeSentimentTest() { String language = "language-1613589672"; AnalyzeSentimentResponse expectedResponse = AnalyzeSentimentResponse.newBuilder().setLanguage(language).build(); mockLanguageService.addResponse(expectedResponse); Document document = Document.newBuilder().build(); AnalyzeSentimentResponse actualResponse = client.analyzeSentiment(document); Assert.assertEquals(expectedResponse, actualResponse); List<GeneratedMessageV3> actualRequests = mockLanguageService.getRequests(); Assert.assertEquals(1, actualRequests.size()); AnalyzeSentimentRequest actualRequest = (AnalyzeSentimentRequest) actualRequests.get(0); Assert.assertEquals(document, actualRequest.getDocument()); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); }
/** * * * <pre> * Input document. * </pre> * * <code>.google.cloud.language.v1.Document document = 1;</code> */ public com.google.cloud.language.v1.DocumentOrBuilder getDocumentOrBuilder() { return getDocument(); }
@java.lang.Override public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { if (document_ != null) { output.writeMessage(1, getDocument()); } if (encodingType_ != com.google.cloud.language.v1.EncodingType.NONE.getNumber()) { output.writeEnum(2, encodingType_); } unknownFields.writeTo(output); }
@java.lang.Override public int getSerializedSize() { int size = memoizedSize; if (size != -1) return size; size = 0; if (document_ != null) { size += com.google.protobuf.CodedOutputStream.computeMessageSize(1, getDocument()); } if (encodingType_ != com.google.cloud.language.v1.EncodingType.NONE.getNumber()) { size += com.google.protobuf.CodedOutputStream.computeEnumSize(2, encodingType_); } size += unknownFields.getSerializedSize(); memoizedSize = size; return size; }
@java.lang.Override public boolean equals(final java.lang.Object obj) { if (obj == this) { return true; } if (!(obj instanceof com.google.cloud.language.v1.AnalyzeSentimentRequest)) { return super.equals(obj); } com.google.cloud.language.v1.AnalyzeSentimentRequest other = (com.google.cloud.language.v1.AnalyzeSentimentRequest) obj; boolean result = true; result = result && (hasDocument() == other.hasDocument()); if (hasDocument()) { result = result && getDocument().equals(other.getDocument()); } result = result && encodingType_ == other.encodingType_; result = result && unknownFields.equals(other.unknownFields); return result; }
@java.lang.Override public int hashCode() { if (memoizedHashCode != 0) { return memoizedHashCode; } int hash = 41; hash = (19 * hash) + getDescriptor().hashCode(); if (hasDocument()) { hash = (37 * hash) + DOCUMENT_FIELD_NUMBER; hash = (53 * hash) + getDocument().hashCode(); } hash = (37 * hash) + ENCODING_TYPE_FIELD_NUMBER; hash = (53 * hash) + encodingType_; hash = (29 * hash) + unknownFields.hashCode(); memoizedHashCode = hash; return hash; }
public Builder mergeFrom(com.google.cloud.language.v1.AnalyzeSentimentRequest other) { if (other == com.google.cloud.language.v1.AnalyzeSentimentRequest.getDefaultInstance()) return this; if (other.hasDocument()) { mergeDocument(other.getDocument()); } if (other.encodingType_ != 0) { setEncodingTypeValue(other.getEncodingTypeValue()); } this.mergeUnknownFields(other.unknownFields); onChanged(); return this; }