Class Segment.Builder (0.58.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
Type Description
Descriptor

Methods

addRepeatedField(Descriptors.FieldDescriptor field, Object value)

public Segment.Builder addRepeatedField(Descriptors.FieldDescriptor field, Object value)
Parameters
Name Description
field FieldDescriptor
value Object
Returns
Type Description
Segment.Builder
Overrides

build()

public Segment build()
Returns
Type Description
Segment

buildPartial()

public Segment buildPartial()
Returns
Type Description
Segment

clear()

public Segment.Builder clear()
Returns
Type Description
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
Type Description
Segment.Builder

clearField(Descriptors.FieldDescriptor field)

public Segment.Builder clearField(Descriptors.FieldDescriptor field)
Parameter
Name Description
field FieldDescriptor
Returns
Type Description
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 (for example "1. Segment", "2. Segment", etc.).

string name = 1;

Returns
Type Description
Segment.Builder

This builder for chaining.

clearOneSegmentScope()

public Segment.Builder clearOneSegmentScope()
Returns
Type Description
Segment.Builder

clearOneof(Descriptors.OneofDescriptor oneof)

public Segment.Builder clearOneof(Descriptors.OneofDescriptor oneof)
Parameter
Name Description
oneof OneofDescriptor
Returns
Type Description
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
Type Description
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
Type Description
Segment.Builder

clone()

public Segment.Builder clone()
Returns
Type Description
Segment.Builder
Overrides

getDefaultInstanceForType()

public Segment getDefaultInstanceForType()
Returns
Type Description
Segment

getDescriptorForType()

public Descriptors.Descriptor getDescriptorForType()
Returns
Type Description
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
Type Description
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
Type Description
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
Type Description
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 (for example "1. Segment", "2. Segment", etc.).

string name = 1;

Returns
Type Description
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 (for example "1. Segment", "2. Segment", etc.).

string name = 1;

Returns
Type Description
ByteString

The bytes for name.

getOneSegmentScopeCase()

public Segment.OneSegmentScopeCase getOneSegmentScopeCase()
Returns
Type Description
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
Type Description
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
Type Description
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
Type Description
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
Type Description
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
Type Description
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
Type Description
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
Type Description
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
Type Description
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
Type Description
boolean

Whether the userSegment field is set.

internalGetFieldAccessorTable()

protected GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable()
Returns
Type Description
FieldAccessorTable
Overrides

isInitialized()

public final boolean isInitialized()
Returns
Type Description
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
Name Description
value EventSegment
Returns
Type Description
Segment.Builder

mergeFrom(Segment other)

public Segment.Builder mergeFrom(Segment other)
Parameter
Name Description
other Segment
Returns
Type Description
Segment.Builder

mergeFrom(CodedInputStream input, ExtensionRegistryLite extensionRegistry)

public Segment.Builder mergeFrom(CodedInputStream input, ExtensionRegistryLite extensionRegistry)
Parameters
Name Description
input CodedInputStream
extensionRegistry ExtensionRegistryLite
Returns
Type Description
Segment.Builder
Overrides
Exceptions
Type Description
IOException

mergeFrom(Message other)

public Segment.Builder mergeFrom(Message other)
Parameter
Name Description
other Message
Returns
Type Description
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
Name Description
value SessionSegment
Returns
Type Description
Segment.Builder

mergeUnknownFields(UnknownFieldSet unknownFields)

public final Segment.Builder mergeUnknownFields(UnknownFieldSet unknownFields)
Parameter
Name Description
unknownFields UnknownFieldSet
Returns
Type Description
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
Name Description
value UserSegment
Returns
Type Description
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
Name Description
value EventSegment
Returns
Type Description
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
Name Description
builderForValue EventSegment.Builder
Returns
Type Description
Segment.Builder

setField(Descriptors.FieldDescriptor field, Object value)

public Segment.Builder setField(Descriptors.FieldDescriptor field, Object value)
Parameters
Name Description
field FieldDescriptor
value Object
Returns
Type Description
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 (for example "1. Segment", "2. Segment", etc.).

string name = 1;

Parameter
Name Description
value String

The name to set.

Returns
Type Description
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 (for example "1. Segment", "2. Segment", etc.).

string name = 1;

Parameter
Name Description
value ByteString

The bytes for name to set.

Returns
Type Description
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
Name Description
field FieldDescriptor
index int
value Object
Returns
Type Description
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
Name Description
value SessionSegment
Returns
Type Description
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
Name Description
builderForValue SessionSegment.Builder
Returns
Type Description
Segment.Builder

setUnknownFields(UnknownFieldSet unknownFields)

public final Segment.Builder setUnknownFields(UnknownFieldSet unknownFields)
Parameter
Name Description
unknownFields UnknownFieldSet
Returns
Type Description
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
Name Description
value UserSegment
Returns
Type Description
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
Name Description
builderForValue UserSegment.Builder
Returns
Type Description
Segment.Builder