Class Sentiment.Builder (2.4.1)

publicstaticfinalclass Sentiment.BuilderextendsGeneratedMessageV3.Builder<Sentiment.Builder>implementsSentimentOrBuilder

Represents the feeling associated with the entire text or entities in the text.

Protobuf type google.cloud.language.v1.Sentiment

Implements

SentimentOrBuilder

Inherited Members

com.google.protobuf.GeneratedMessageV3.Builder.getUnknownFieldSetBuilder()
com.google.protobuf.GeneratedMessageV3.Builder.mergeUnknownLengthDelimitedField(int,com.google.protobuf.ByteString)
com.google.protobuf.GeneratedMessageV3.Builder.mergeUnknownVarintField(int,int)
com.google.protobuf.GeneratedMessageV3.Builder.parseUnknownField(com.google.protobuf.CodedInputStream,com.google.protobuf.ExtensionRegistryLite,int)
com.google.protobuf.GeneratedMessageV3.Builder.setUnknownFieldSetBuilder(com.google.protobuf.UnknownFieldSet.Builder)

Static Methods

getDescriptor()

publicstaticfinalDescriptors.DescriptorgetDescriptor()
Returns
Type Description

Methods

addRepeatedField(Descriptors.FieldDescriptor field, Object value)

publicSentiment.BuilderaddRepeatedField(Descriptors.FieldDescriptorfield,Objectvalue)
Parameters
Name Description
value Object
Returns
Type Description
Overrides

build()

publicSentimentbuild()
Returns
Type Description

buildPartial()

publicSentimentbuildPartial()
Returns
Type Description

clear()

publicSentiment.Builderclear()
Returns
Type Description
Overrides

clearField(Descriptors.FieldDescriptor field)

publicSentiment.BuilderclearField(Descriptors.FieldDescriptorfield)
Parameter
Name Description
Returns
Type Description
Overrides

clearMagnitude()

publicSentiment.BuilderclearMagnitude()

A non-negative number in the [0, +inf) range, which represents the absolute magnitude of sentiment regardless of score (positive or negative).

float magnitude = 2;

Returns
Type Description
Sentiment.Builder

This builder for chaining.

clearOneof(Descriptors.OneofDescriptor oneof)

publicSentiment.BuilderclearOneof(Descriptors.OneofDescriptoroneof)
Parameter
Name Description
Returns
Type Description
Overrides

clearScore()

publicSentiment.BuilderclearScore()

Sentiment score between -1.0 (negative sentiment) and 1.0 (positive sentiment).

float score = 3;

Returns
Type Description
Sentiment.Builder

This builder for chaining.

clone()

publicSentiment.Builderclone()
Returns
Type Description
Overrides

getDefaultInstanceForType()

publicSentimentgetDefaultInstanceForType()
Returns
Type Description

getDescriptorForType()

publicDescriptors.DescriptorgetDescriptorForType()
Returns
Type Description
Overrides

getMagnitude()

publicfloatgetMagnitude()

A non-negative number in the [0, +inf) range, which represents the absolute magnitude of sentiment regardless of score (positive or negative).

float magnitude = 2;

Returns
Type Description
float

The magnitude.

getScore()

publicfloatgetScore()

Sentiment score between -1.0 (negative sentiment) and 1.0 (positive sentiment).

float score = 3;

Returns
Type Description
float

The score.

internalGetFieldAccessorTable()

protectedGeneratedMessageV3.FieldAccessorTableinternalGetFieldAccessorTable()
Returns
Type Description
Overrides

isInitialized()

publicfinalbooleanisInitialized()
Returns
Type Description
Overrides

mergeFrom(Sentiment other)

publicSentiment.BuildermergeFrom(Sentimentother)
Parameter
Name Description
other Sentiment
Returns
Type Description

mergeFrom(CodedInputStream input, ExtensionRegistryLite extensionRegistry)

publicSentiment.BuildermergeFrom(CodedInputStreaminput,ExtensionRegistryLiteextensionRegistry)
Parameters
Name Description
extensionRegistry ExtensionRegistryLite
Returns
Type Description
Overrides Exceptions
Type Description

mergeFrom(Message other)

publicSentiment.BuildermergeFrom(Messageother)
Parameter
Name Description
other Message
Returns
Type Description
Overrides

mergeUnknownFields(UnknownFieldSet unknownFields)

publicfinalSentiment.BuildermergeUnknownFields(UnknownFieldSetunknownFields)
Parameter
Name Description
unknownFields UnknownFieldSet
Returns
Type Description
Overrides

setField(Descriptors.FieldDescriptor field, Object value)

publicSentiment.BuildersetField(Descriptors.FieldDescriptorfield,Objectvalue)
Parameters
Name Description
value Object
Returns
Type Description
Overrides

setMagnitude(float value)

publicSentiment.BuildersetMagnitude(floatvalue)

A non-negative number in the [0, +inf) range, which represents the absolute magnitude of sentiment regardless of score (positive or negative).

float magnitude = 2;

Parameter
Name Description
value float

The magnitude to set.

Returns
Type Description
Sentiment.Builder

This builder for chaining.

setRepeatedField(Descriptors.FieldDescriptor field, int index, Object value)

publicSentiment.BuildersetRepeatedField(Descriptors.FieldDescriptorfield,intindex,Objectvalue)
Parameters
Name Description
index int
value Object
Returns
Type Description
Overrides

setScore(float value)

publicSentiment.BuildersetScore(floatvalue)

Sentiment score between -1.0 (negative sentiment) and 1.0 (positive sentiment).

float score = 3;

Parameter
Name Description
value float

The score to set.

Returns
Type Description
Sentiment.Builder

This builder for chaining.

setUnknownFields(UnknownFieldSet unknownFields)

publicfinalSentiment.BuildersetUnknownFields(UnknownFieldSetunknownFields)
Parameter
Name Description
unknownFields UnknownFieldSet
Returns
Type Description
Overrides

Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2025年10月30日 UTC.