Class Segment.Builder (0.22.0)

public static final class Segment.Builder extends GeneratedMessageV3.Builder<Segment.Builder> implements SegmentOrBuilder

A segment is a subset of your Analytics data. For example, of your entire set of users, one segment might be users from a particular country or city. Another segment might be users who purchase a particular line of products or who visit a specific part of your site or trigger certain events in your app. To learn more, see GA4 Segment Builder.

Protobuf type google.analytics.data.v1alpha.Segment

Implements

SegmentOrBuilder

Static Methods

getDescriptor()

public static final Descriptors.Descriptor getDescriptor()
Returns
TypeDescription
Descriptor

Methods

addRepeatedField(Descriptors.FieldDescriptor field, Object value)

public Segment.Builder addRepeatedField(Descriptors.FieldDescriptor field, Object value)
Parameters
NameDescription
fieldFieldDescriptor
valueObject
Returns
TypeDescription
Segment.Builder
Overrides

build()

public Segment build()
Returns
TypeDescription
Segment

buildPartial()

public Segment buildPartial()
Returns
TypeDescription
Segment

clear()

public Segment.Builder clear()
Returns
TypeDescription
Segment.Builder
Overrides

clearEventSegment()

public Segment.Builder clearEventSegment()

Event segments are subsets of events that were triggered on your site or app.

.google.analytics.data.v1alpha.EventSegment event_segment = 4;

Returns
TypeDescription
Segment.Builder

clearField(Descriptors.FieldDescriptor field)

public Segment.Builder clearField(Descriptors.FieldDescriptor field)
Parameter
NameDescription
fieldFieldDescriptor
Returns
TypeDescription
Segment.Builder
Overrides

clearName()

public Segment.Builder clearName()

The name for this segment. If unspecified, segments are named "Segment". This name defines string value returned by the segment dimension. The segment dimension prefixes segment names by the 1-based index number of the segment in the request (i.e. "1. Segment", "2. Segment", etc.).

string name = 1;

Returns
TypeDescription
Segment.Builder

This builder for chaining.

clearOneSegmentScope()

public Segment.Builder clearOneSegmentScope()
Returns
TypeDescription
Segment.Builder

clearOneof(Descriptors.OneofDescriptor oneof)

public Segment.Builder clearOneof(Descriptors.OneofDescriptor oneof)
Parameter
NameDescription
oneofOneofDescriptor
Returns
TypeDescription
Segment.Builder
Overrides

clearSessionSegment()

public Segment.Builder clearSessionSegment()

Session segments are subsets of the sessions that occurred on your site or app.

.google.analytics.data.v1alpha.SessionSegment session_segment = 3;

Returns
TypeDescription
Segment.Builder

clearUserSegment()

public Segment.Builder clearUserSegment()

User segments are subsets of users who engaged with your site or app.

.google.analytics.data.v1alpha.UserSegment user_segment = 2;

Returns
TypeDescription
Segment.Builder

clone()

public Segment.Builder clone()
Returns
TypeDescription
Segment.Builder
Overrides

getDefaultInstanceForType()

public Segment getDefaultInstanceForType()
Returns
TypeDescription
Segment

getDescriptorForType()

public Descriptors.Descriptor getDescriptorForType()
Returns
TypeDescription
Descriptor
Overrides

getEventSegment()

public EventSegment getEventSegment()

Event segments are subsets of events that were triggered on your site or app.

.google.analytics.data.v1alpha.EventSegment event_segment = 4;

Returns
TypeDescription
EventSegment

The eventSegment.

getEventSegmentBuilder()

public EventSegment.Builder getEventSegmentBuilder()

Event segments are subsets of events that were triggered on your site or app.

.google.analytics.data.v1alpha.EventSegment event_segment = 4;

Returns
TypeDescription
EventSegment.Builder

getEventSegmentOrBuilder()

public EventSegmentOrBuilder getEventSegmentOrBuilder()

Event segments are subsets of events that were triggered on your site or app.

.google.analytics.data.v1alpha.EventSegment event_segment = 4;

Returns
TypeDescription
EventSegmentOrBuilder

getName()

public String getName()

The name for this segment. If unspecified, segments are named "Segment". This name defines string value returned by the segment dimension. The segment dimension prefixes segment names by the 1-based index number of the segment in the request (i.e. "1. Segment", "2. Segment", etc.).

string name = 1;

Returns
TypeDescription
String

The name.

getNameBytes()

public ByteString getNameBytes()

The name for this segment. If unspecified, segments are named "Segment". This name defines string value returned by the segment dimension. The segment dimension prefixes segment names by the 1-based index number of the segment in the request (i.e. "1. Segment", "2. Segment", etc.).

string name = 1;

Returns
TypeDescription
ByteString

The bytes for name.

getOneSegmentScopeCase()

public Segment.OneSegmentScopeCase getOneSegmentScopeCase()
Returns
TypeDescription
Segment.OneSegmentScopeCase

getSessionSegment()

public SessionSegment getSessionSegment()

Session segments are subsets of the sessions that occurred on your site or app.

.google.analytics.data.v1alpha.SessionSegment session_segment = 3;

Returns
TypeDescription
SessionSegment

The sessionSegment.

getSessionSegmentBuilder()

public SessionSegment.Builder getSessionSegmentBuilder()

Session segments are subsets of the sessions that occurred on your site or app.

.google.analytics.data.v1alpha.SessionSegment session_segment = 3;

Returns
TypeDescription
SessionSegment.Builder

getSessionSegmentOrBuilder()

public SessionSegmentOrBuilder getSessionSegmentOrBuilder()

Session segments are subsets of the sessions that occurred on your site or app.

.google.analytics.data.v1alpha.SessionSegment session_segment = 3;

Returns
TypeDescription
SessionSegmentOrBuilder

getUserSegment()

public UserSegment getUserSegment()

User segments are subsets of users who engaged with your site or app.

.google.analytics.data.v1alpha.UserSegment user_segment = 2;

Returns
TypeDescription
UserSegment

The userSegment.

getUserSegmentBuilder()

public UserSegment.Builder getUserSegmentBuilder()

User segments are subsets of users who engaged with your site or app.

.google.analytics.data.v1alpha.UserSegment user_segment = 2;

Returns
TypeDescription
UserSegment.Builder

getUserSegmentOrBuilder()

public UserSegmentOrBuilder getUserSegmentOrBuilder()

User segments are subsets of users who engaged with your site or app.

.google.analytics.data.v1alpha.UserSegment user_segment = 2;

Returns
TypeDescription
UserSegmentOrBuilder

hasEventSegment()

public boolean hasEventSegment()

Event segments are subsets of events that were triggered on your site or app.

.google.analytics.data.v1alpha.EventSegment event_segment = 4;

Returns
TypeDescription
boolean

Whether the eventSegment field is set.

hasSessionSegment()

public boolean hasSessionSegment()

Session segments are subsets of the sessions that occurred on your site or app.

.google.analytics.data.v1alpha.SessionSegment session_segment = 3;

Returns
TypeDescription
boolean

Whether the sessionSegment field is set.

hasUserSegment()

public boolean hasUserSegment()

User segments are subsets of users who engaged with your site or app.

.google.analytics.data.v1alpha.UserSegment user_segment = 2;

Returns
TypeDescription
boolean

Whether the userSegment field is set.

internalGetFieldAccessorTable()

protected GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable()
Returns
TypeDescription
FieldAccessorTable
Overrides

isInitialized()

public final boolean isInitialized()
Returns
TypeDescription
boolean
Overrides

mergeEventSegment(EventSegment value)

public Segment.Builder mergeEventSegment(EventSegment value)

Event segments are subsets of events that were triggered on your site or app.

.google.analytics.data.v1alpha.EventSegment event_segment = 4;

Parameter
NameDescription
valueEventSegment
Returns
TypeDescription
Segment.Builder

mergeFrom(Segment other)

public Segment.Builder mergeFrom(Segment other)
Parameter
NameDescription
otherSegment
Returns
TypeDescription
Segment.Builder

mergeFrom(CodedInputStream input, ExtensionRegistryLite extensionRegistry)

public Segment.Builder mergeFrom(CodedInputStream input, ExtensionRegistryLite extensionRegistry)
Parameters
NameDescription
inputCodedInputStream
extensionRegistryExtensionRegistryLite
Returns
TypeDescription
Segment.Builder
Overrides Exceptions
TypeDescription
IOException

mergeFrom(Message other)

public Segment.Builder mergeFrom(Message other)
Parameter
NameDescription
otherMessage
Returns
TypeDescription
Segment.Builder
Overrides

mergeSessionSegment(SessionSegment value)

public Segment.Builder mergeSessionSegment(SessionSegment value)

Session segments are subsets of the sessions that occurred on your site or app.

.google.analytics.data.v1alpha.SessionSegment session_segment = 3;

Parameter
NameDescription
valueSessionSegment
Returns
TypeDescription
Segment.Builder

mergeUnknownFields(UnknownFieldSet unknownFields)

public final Segment.Builder mergeUnknownFields(UnknownFieldSet unknownFields)
Parameter
NameDescription
unknownFieldsUnknownFieldSet
Returns
TypeDescription
Segment.Builder
Overrides

mergeUserSegment(UserSegment value)

public Segment.Builder mergeUserSegment(UserSegment value)

User segments are subsets of users who engaged with your site or app.

.google.analytics.data.v1alpha.UserSegment user_segment = 2;

Parameter
NameDescription
valueUserSegment
Returns
TypeDescription
Segment.Builder

setEventSegment(EventSegment value)

public Segment.Builder setEventSegment(EventSegment value)

Event segments are subsets of events that were triggered on your site or app.

.google.analytics.data.v1alpha.EventSegment event_segment = 4;

Parameter
NameDescription
valueEventSegment
Returns
TypeDescription
Segment.Builder

setEventSegment(EventSegment.Builder builderForValue)

public Segment.Builder setEventSegment(EventSegment.Builder builderForValue)

Event segments are subsets of events that were triggered on your site or app.

.google.analytics.data.v1alpha.EventSegment event_segment = 4;

Parameter
NameDescription
builderForValueEventSegment.Builder
Returns
TypeDescription
Segment.Builder

setField(Descriptors.FieldDescriptor field, Object value)

public Segment.Builder setField(Descriptors.FieldDescriptor field, Object value)
Parameters
NameDescription
fieldFieldDescriptor
valueObject
Returns
TypeDescription
Segment.Builder
Overrides

setName(String value)

public Segment.Builder setName(String value)

The name for this segment. If unspecified, segments are named "Segment". This name defines string value returned by the segment dimension. The segment dimension prefixes segment names by the 1-based index number of the segment in the request (i.e. "1. Segment", "2. Segment", etc.).

string name = 1;

Parameter
NameDescription
valueString

The name to set.

Returns
TypeDescription
Segment.Builder

This builder for chaining.

setNameBytes(ByteString value)

public Segment.Builder setNameBytes(ByteString value)

The name for this segment. If unspecified, segments are named "Segment". This name defines string value returned by the segment dimension. The segment dimension prefixes segment names by the 1-based index number of the segment in the request (i.e. "1. Segment", "2. Segment", etc.).

string name = 1;

Parameter
NameDescription
valueByteString

The bytes for name to set.

Returns
TypeDescription
Segment.Builder

This builder for chaining.

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

public Segment.Builder setRepeatedField(Descriptors.FieldDescriptor field, int index, Object value)
Parameters
NameDescription
fieldFieldDescriptor
indexint
valueObject
Returns
TypeDescription
Segment.Builder
Overrides

setSessionSegment(SessionSegment value)

public Segment.Builder setSessionSegment(SessionSegment value)

Session segments are subsets of the sessions that occurred on your site or app.

.google.analytics.data.v1alpha.SessionSegment session_segment = 3;

Parameter
NameDescription
valueSessionSegment
Returns
TypeDescription
Segment.Builder

setSessionSegment(SessionSegment.Builder builderForValue)

public Segment.Builder setSessionSegment(SessionSegment.Builder builderForValue)

Session segments are subsets of the sessions that occurred on your site or app.

.google.analytics.data.v1alpha.SessionSegment session_segment = 3;

Parameter
NameDescription
builderForValueSessionSegment.Builder
Returns
TypeDescription
Segment.Builder

setUnknownFields(UnknownFieldSet unknownFields)

public final Segment.Builder setUnknownFields(UnknownFieldSet unknownFields)
Parameter
NameDescription
unknownFieldsUnknownFieldSet
Returns
TypeDescription
Segment.Builder
Overrides

setUserSegment(UserSegment value)

public Segment.Builder setUserSegment(UserSegment value)

User segments are subsets of users who engaged with your site or app.

.google.analytics.data.v1alpha.UserSegment user_segment = 2;

Parameter
NameDescription
valueUserSegment
Returns
TypeDescription
Segment.Builder

setUserSegment(UserSegment.Builder builderForValue)

public Segment.Builder setUserSegment(UserSegment.Builder builderForValue)

User segments are subsets of users who engaged with your site or app.

.google.analytics.data.v1alpha.UserSegment user_segment = 2;

Parameter
NameDescription
builderForValueUserSegment.Builder
Returns
TypeDescription
Segment.Builder