public Builder mergeFrom(com.google.cloud.language.v1beta2.AnalyzeEntitiesRequest other) { if (other == com.google.cloud.language.v1beta2.AnalyzeEntitiesRequest.getDefaultInstance()) return this; if (other.hasDocument()) { mergeDocument(other.getDocument()); } if (other.encodingType_ != 0) { setEncodingTypeValue(other.getEncodingTypeValue()); } this.mergeUnknownFields(other.unknownFields); onChanged(); return this; }
@java.lang.Override public Builder newBuilderForType() { return newBuilder(); }
@java.lang.Override public com.google.cloud.language.v1beta2.AnalyzeEntitiesRequest buildPartial() { com.google.cloud.language.v1beta2.AnalyzeEntitiesRequest result = new com.google.cloud.language.v1beta2.AnalyzeEntitiesRequest(this); if (documentBuilder_ == null) { result.document_ = document_; } else { result.document_ = documentBuilder_.build(); } result.encodingType_ = encodingType_; onBuilt(); 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.v1beta2.AnalyzeEntitiesRequest)) { return super.equals(obj); } com.google.cloud.language.v1beta2.AnalyzeEntitiesRequest other = (com.google.cloud.language.v1beta2.AnalyzeEntitiesRequest) 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; }
/** * * * <pre> * Input document. * </pre> * * <code>.google.cloud.language.v1beta2.Document document = 1;</code> */ public com.google.cloud.language.v1beta2.DocumentOrBuilder getDocumentOrBuilder() { return getDocument(); }
@Test @SuppressWarnings("all") public void analyzeEntitiesTest() { String language = "language-1613589672"; AnalyzeEntitiesResponse expectedResponse = AnalyzeEntitiesResponse.newBuilder().setLanguage(language).build(); mockLanguageService.addResponse(expectedResponse); Document document = Document.newBuilder().build(); EncodingType encodingType = EncodingType.NONE; AnalyzeEntitiesResponse actualResponse = client.analyzeEntities(document, encodingType); Assert.assertEquals(expectedResponse, actualResponse); List<GeneratedMessageV3> actualRequests = mockLanguageService.getRequests(); Assert.assertEquals(1, actualRequests.size()); AnalyzeEntitiesRequest actualRequest = (AnalyzeEntitiesRequest) actualRequests.get(0); Assert.assertEquals(document, actualRequest.getDocument()); Assert.assertEquals(encodingType, actualRequest.getEncodingType()); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); }
@java.lang.Override public com.google.cloud.language.v1beta2.AnalyzeEntitiesRequest getDefaultInstanceForType() { return com.google.cloud.language.v1beta2.AnalyzeEntitiesRequest.getDefaultInstance(); }
if (!parseUnknownFieldProto3(input, unknownFields, extensionRegistry, tag)) { done = true; } finally { this.unknownFields = unknownFields.build(); makeExtensionsImmutable();
@java.lang.Override public com.google.cloud.language.v1beta2.AnalyzeEntitiesRequest build() { com.google.cloud.language.v1beta2.AnalyzeEntitiesRequest result = buildPartial(); if (!result.isInitialized()) { throw newUninitializedMessageException(result); } return result; }
@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.v1beta2.EncodingType.NONE.getNumber()) { output.writeEnum(2, encodingType_); } unknownFields.writeTo(output); }
io.grpc.protobuf.ProtoUtils.marshaller( com.google.cloud.language.v1beta2.AnalyzeEntitiesRequest .getDefaultInstance())) .setResponseMarshaller( io.grpc.protobuf.ProtoUtils.marshaller(
@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.v1beta2.EncodingType.NONE.getNumber()) { size += com.google.protobuf.CodedOutputStream.computeEnumSize(2, encodingType_); } size += unknownFields.getSerializedSize(); memoizedSize = size; return size; }
/** * Finds named entities (currently proper names and common nouns) in the text along with entity * types, salience, mentions for each entity, and other properties. * * <p>Sample code: * * <pre><code> * try (LanguageServiceClient languageServiceClient = LanguageServiceClient.create()) { * Document document = Document.newBuilder().build(); * EncodingType encodingType = EncodingType.NONE; * AnalyzeEntitiesResponse response = languageServiceClient.analyzeEntities(document, encodingType); * } * </code></pre> * * @param document Input document. * @param encodingType The encoding type used by the API to calculate offsets. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final AnalyzeEntitiesResponse analyzeEntities( Document document, EncodingType encodingType) { AnalyzeEntitiesRequest request = AnalyzeEntitiesRequest.newBuilder() .setDocument(document) .setEncodingType(encodingType) .build(); return analyzeEntities(request); }
/** * Finds named entities (currently proper names and common nouns) in the text along with entity * types, salience, mentions for each entity, and other properties. * * <p>Sample code: * * <pre><code> * try (LanguageServiceClient languageServiceClient = LanguageServiceClient.create()) { * Document document = Document.newBuilder().build(); * EncodingType encodingType = EncodingType.NONE; * AnalyzeEntitiesResponse response = languageServiceClient.analyzeEntities(document, encodingType); * } * </code></pre> * * @param document Input document. * @param encodingType The encoding type used by the API to calculate offsets. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final AnalyzeEntitiesResponse analyzeEntities( Document document, EncodingType encodingType) { AnalyzeEntitiesRequest request = AnalyzeEntitiesRequest.newBuilder() .setDocument(document) .setEncodingType(encodingType) .build(); return analyzeEntities(request); }