Class CalculatedMetric.Builder (0.51.0)

public static final class CalculatedMetric.Builder extends GeneratedMessageV3.Builder<CalculatedMetric.Builder> implements CalculatedMetricOrBuilder

A definition for a calculated metric.

Protobuf type google.analytics.admin.v1alpha.CalculatedMetric

Static Methods

getDescriptor()

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

Methods

addAllRestrictedMetricType(Iterable<? extends CalculatedMetric.RestrictedMetricType> values)

public CalculatedMetric.Builder addAllRestrictedMetricType(Iterable<? extends CalculatedMetric.RestrictedMetricType> values)

Output only. Types of restricted data that this metric contains.

repeated .google.analytics.admin.v1alpha.CalculatedMetric.RestrictedMetricType restricted_metric_type = 6 [(.google.api.field_behavior) = OUTPUT_ONLY];

Parameter
NameDescription
valuesIterable<? extends com.google.analytics.admin.v1alpha.CalculatedMetric.RestrictedMetricType>

The restrictedMetricType to add.

Returns
TypeDescription
CalculatedMetric.Builder

This builder for chaining.

addAllRestrictedMetricTypeValue(Iterable<Integer> values)

public CalculatedMetric.Builder addAllRestrictedMetricTypeValue(Iterable<Integer> values)

Output only. Types of restricted data that this metric contains.

repeated .google.analytics.admin.v1alpha.CalculatedMetric.RestrictedMetricType restricted_metric_type = 6 [(.google.api.field_behavior) = OUTPUT_ONLY];

Parameter
NameDescription
valuesIterable<Integer>

The enum numeric values on the wire for restrictedMetricType to add.

Returns
TypeDescription
CalculatedMetric.Builder

This builder for chaining.

addRepeatedField(Descriptors.FieldDescriptor field, Object value)

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

addRestrictedMetricType(CalculatedMetric.RestrictedMetricType value)

public CalculatedMetric.Builder addRestrictedMetricType(CalculatedMetric.RestrictedMetricType value)

Output only. Types of restricted data that this metric contains.

repeated .google.analytics.admin.v1alpha.CalculatedMetric.RestrictedMetricType restricted_metric_type = 6 [(.google.api.field_behavior) = OUTPUT_ONLY];

Parameter
NameDescription
valueCalculatedMetric.RestrictedMetricType

The restrictedMetricType to add.

Returns
TypeDescription
CalculatedMetric.Builder

This builder for chaining.

addRestrictedMetricTypeValue(int value)

public CalculatedMetric.Builder addRestrictedMetricTypeValue(int value)

Output only. Types of restricted data that this metric contains.

repeated .google.analytics.admin.v1alpha.CalculatedMetric.RestrictedMetricType restricted_metric_type = 6 [(.google.api.field_behavior) = OUTPUT_ONLY];

Parameter
NameDescription
valueint

The enum numeric value on the wire for restrictedMetricType to add.

Returns
TypeDescription
CalculatedMetric.Builder

This builder for chaining.

build()

public CalculatedMetric build()
Returns
TypeDescription
CalculatedMetric

buildPartial()

public CalculatedMetric buildPartial()
Returns
TypeDescription
CalculatedMetric

clear()

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

clearCalculatedMetricId()

public CalculatedMetric.Builder clearCalculatedMetricId()

Output only. The ID to use for the calculated metric. In the UI, this is referred to as the "API name."

The calculated_metric_id is used when referencing this calculated metric from external APIs. For example, "calcMetric:{calculated_metric_id}".

string calculated_metric_id = 4 [(.google.api.field_behavior) = OUTPUT_ONLY];

Returns
TypeDescription
CalculatedMetric.Builder

This builder for chaining.

clearDescription()

public CalculatedMetric.Builder clearDescription()

Optional. Description for this calculated metric. Max length of 4096 characters.

string description = 2 [(.google.api.field_behavior) = OPTIONAL];

Returns
TypeDescription
CalculatedMetric.Builder

This builder for chaining.

clearDisplayName()

public CalculatedMetric.Builder clearDisplayName()

Required. Display name for this calculated metric as shown in the Google Analytics UI. Max length 82 characters.

string display_name = 3 [(.google.api.field_behavior) = REQUIRED];

Returns
TypeDescription
CalculatedMetric.Builder

This builder for chaining.

clearField(Descriptors.FieldDescriptor field)

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

clearFormula()

public CalculatedMetric.Builder clearFormula()

Required. The calculated metric's definition. Maximum number of unique referenced custom metrics is 5. Formulas supports the following operations:

  • (addition), - (subtraction), - (negative), * (multiplication), / (division), () (parenthesis). Any valid real numbers are acceptable that fit in a Long (64bit integer) or a Double (64 bit floating point number). Example formula: "( customEvent:parameter_name + cartPurchaseQuantity ) / 2.0"

string formula = 7 [(.google.api.field_behavior) = REQUIRED];

Returns
TypeDescription
CalculatedMetric.Builder

This builder for chaining.

clearInvalidMetricReference()

public CalculatedMetric.Builder clearInvalidMetricReference()

Output only. If true, this calculated metric has a invalid metric reference. Anything using a calculated metric with invalid_metric_reference set to true may fail, produce warnings, or produce unexpected results.

bool invalid_metric_reference = 9 [(.google.api.field_behavior) = OUTPUT_ONLY];

Returns
TypeDescription
CalculatedMetric.Builder

This builder for chaining.

clearMetricUnit()

public CalculatedMetric.Builder clearMetricUnit()

Required. The type for the calculated metric's value.

.google.analytics.admin.v1alpha.CalculatedMetric.MetricUnit metric_unit = 5 [(.google.api.field_behavior) = REQUIRED];

Returns
TypeDescription
CalculatedMetric.Builder

This builder for chaining.

clearName()

public CalculatedMetric.Builder clearName()

Output only. Resource name for this CalculatedMetric. Format: 'properties/{property_id}/calculatedMetrics/{calculated_metric_id}'

string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY];

Returns
TypeDescription
CalculatedMetric.Builder

This builder for chaining.

clearOneof(Descriptors.OneofDescriptor oneof)

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

clearRestrictedMetricType()

public CalculatedMetric.Builder clearRestrictedMetricType()

Output only. Types of restricted data that this metric contains.

repeated .google.analytics.admin.v1alpha.CalculatedMetric.RestrictedMetricType restricted_metric_type = 6 [(.google.api.field_behavior) = OUTPUT_ONLY];

Returns
TypeDescription
CalculatedMetric.Builder

This builder for chaining.

clone()

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

getCalculatedMetricId()

public String getCalculatedMetricId()

Output only. The ID to use for the calculated metric. In the UI, this is referred to as the "API name."

The calculated_metric_id is used when referencing this calculated metric from external APIs. For example, "calcMetric:{calculated_metric_id}".

string calculated_metric_id = 4 [(.google.api.field_behavior) = OUTPUT_ONLY];

Returns
TypeDescription
String

The calculatedMetricId.

getCalculatedMetricIdBytes()

public ByteString getCalculatedMetricIdBytes()

Output only. The ID to use for the calculated metric. In the UI, this is referred to as the "API name."

The calculated_metric_id is used when referencing this calculated metric from external APIs. For example, "calcMetric:{calculated_metric_id}".

string calculated_metric_id = 4 [(.google.api.field_behavior) = OUTPUT_ONLY];

Returns
TypeDescription
ByteString

The bytes for calculatedMetricId.

getDefaultInstanceForType()

public CalculatedMetric getDefaultInstanceForType()
Returns
TypeDescription
CalculatedMetric

getDescription()

public String getDescription()

Optional. Description for this calculated metric. Max length of 4096 characters.

string description = 2 [(.google.api.field_behavior) = OPTIONAL];

Returns
TypeDescription
String

The description.

getDescriptionBytes()

public ByteString getDescriptionBytes()

Optional. Description for this calculated metric. Max length of 4096 characters.

string description = 2 [(.google.api.field_behavior) = OPTIONAL];

Returns
TypeDescription
ByteString

The bytes for description.

getDescriptorForType()

public Descriptors.Descriptor getDescriptorForType()
Returns
TypeDescription
Descriptor
Overrides

getDisplayName()

public String getDisplayName()

Required. Display name for this calculated metric as shown in the Google Analytics UI. Max length 82 characters.

string display_name = 3 [(.google.api.field_behavior) = REQUIRED];

Returns
TypeDescription
String

The displayName.

getDisplayNameBytes()

public ByteString getDisplayNameBytes()

Required. Display name for this calculated metric as shown in the Google Analytics UI. Max length 82 characters.

string display_name = 3 [(.google.api.field_behavior) = REQUIRED];

Returns
TypeDescription
ByteString

The bytes for displayName.

getFormula()

public String getFormula()

Required. The calculated metric's definition. Maximum number of unique referenced custom metrics is 5. Formulas supports the following operations:

  • (addition), - (subtraction), - (negative), * (multiplication), / (division), () (parenthesis). Any valid real numbers are acceptable that fit in a Long (64bit integer) or a Double (64 bit floating point number). Example formula: "( customEvent:parameter_name + cartPurchaseQuantity ) / 2.0"

string formula = 7 [(.google.api.field_behavior) = REQUIRED];

Returns
TypeDescription
String

The formula.

getFormulaBytes()

public ByteString getFormulaBytes()

Required. The calculated metric's definition. Maximum number of unique referenced custom metrics is 5. Formulas supports the following operations:

  • (addition), - (subtraction), - (negative), * (multiplication), / (division), () (parenthesis). Any valid real numbers are acceptable that fit in a Long (64bit integer) or a Double (64 bit floating point number). Example formula: "( customEvent:parameter_name + cartPurchaseQuantity ) / 2.0"

string formula = 7 [(.google.api.field_behavior) = REQUIRED];

Returns
TypeDescription
ByteString

The bytes for formula.

getInvalidMetricReference()

public boolean getInvalidMetricReference()

Output only. If true, this calculated metric has a invalid metric reference. Anything using a calculated metric with invalid_metric_reference set to true may fail, produce warnings, or produce unexpected results.

bool invalid_metric_reference = 9 [(.google.api.field_behavior) = OUTPUT_ONLY];

Returns
TypeDescription
boolean

The invalidMetricReference.

getMetricUnit()

public CalculatedMetric.MetricUnit getMetricUnit()

Required. The type for the calculated metric's value.

.google.analytics.admin.v1alpha.CalculatedMetric.MetricUnit metric_unit = 5 [(.google.api.field_behavior) = REQUIRED];

Returns
TypeDescription
CalculatedMetric.MetricUnit

The metricUnit.

getMetricUnitValue()

public int getMetricUnitValue()

Required. The type for the calculated metric's value.

.google.analytics.admin.v1alpha.CalculatedMetric.MetricUnit metric_unit = 5 [(.google.api.field_behavior) = REQUIRED];

Returns
TypeDescription
int

The enum numeric value on the wire for metricUnit.

getName()

public String getName()

Output only. Resource name for this CalculatedMetric. Format: 'properties/{property_id}/calculatedMetrics/{calculated_metric_id}'

string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY];

Returns
TypeDescription
String

The name.

getNameBytes()

public ByteString getNameBytes()

Output only. Resource name for this CalculatedMetric. Format: 'properties/{property_id}/calculatedMetrics/{calculated_metric_id}'

string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY];

Returns
TypeDescription
ByteString

The bytes for name.

getRestrictedMetricType(int index)

public CalculatedMetric.RestrictedMetricType getRestrictedMetricType(int index)

Output only. Types of restricted data that this metric contains.

repeated .google.analytics.admin.v1alpha.CalculatedMetric.RestrictedMetricType restricted_metric_type = 6 [(.google.api.field_behavior) = OUTPUT_ONLY];

Parameter
NameDescription
indexint

The index of the element to return.

Returns
TypeDescription
CalculatedMetric.RestrictedMetricType

The restrictedMetricType at the given index.

getRestrictedMetricTypeCount()

public int getRestrictedMetricTypeCount()

Output only. Types of restricted data that this metric contains.

repeated .google.analytics.admin.v1alpha.CalculatedMetric.RestrictedMetricType restricted_metric_type = 6 [(.google.api.field_behavior) = OUTPUT_ONLY];

Returns
TypeDescription
int

The count of restrictedMetricType.

getRestrictedMetricTypeList()

public List<CalculatedMetric.RestrictedMetricType> getRestrictedMetricTypeList()

Output only. Types of restricted data that this metric contains.

repeated .google.analytics.admin.v1alpha.CalculatedMetric.RestrictedMetricType restricted_metric_type = 6 [(.google.api.field_behavior) = OUTPUT_ONLY];

Returns
TypeDescription
List<RestrictedMetricType>

A list containing the restrictedMetricType.

getRestrictedMetricTypeValue(int index)

public int getRestrictedMetricTypeValue(int index)

Output only. Types of restricted data that this metric contains.

repeated .google.analytics.admin.v1alpha.CalculatedMetric.RestrictedMetricType restricted_metric_type = 6 [(.google.api.field_behavior) = OUTPUT_ONLY];

Parameter
NameDescription
indexint

The index of the value to return.

Returns
TypeDescription
int

The enum numeric value on the wire of restrictedMetricType at the given index.

getRestrictedMetricTypeValueList()

public List<Integer> getRestrictedMetricTypeValueList()

Output only. Types of restricted data that this metric contains.

repeated .google.analytics.admin.v1alpha.CalculatedMetric.RestrictedMetricType restricted_metric_type = 6 [(.google.api.field_behavior) = OUTPUT_ONLY];

Returns
TypeDescription
List<Integer>

A list containing the enum numeric values on the wire for restrictedMetricType.

internalGetFieldAccessorTable()

protected GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable()
Returns
TypeDescription
FieldAccessorTable
Overrides

isInitialized()

public final boolean isInitialized()
Returns
TypeDescription
boolean
Overrides

mergeFrom(CalculatedMetric other)

public CalculatedMetric.Builder mergeFrom(CalculatedMetric other)
Parameter
NameDescription
otherCalculatedMetric
Returns
TypeDescription
CalculatedMetric.Builder

mergeFrom(CodedInputStream input, ExtensionRegistryLite extensionRegistry)

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

mergeFrom(Message other)

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

mergeUnknownFields(UnknownFieldSet unknownFields)

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

setCalculatedMetricId(String value)

public CalculatedMetric.Builder setCalculatedMetricId(String value)

Output only. The ID to use for the calculated metric. In the UI, this is referred to as the "API name."

The calculated_metric_id is used when referencing this calculated metric from external APIs. For example, "calcMetric:{calculated_metric_id}".

string calculated_metric_id = 4 [(.google.api.field_behavior) = OUTPUT_ONLY];

Parameter
NameDescription
valueString

The calculatedMetricId to set.

Returns
TypeDescription
CalculatedMetric.Builder

This builder for chaining.

setCalculatedMetricIdBytes(ByteString value)

public CalculatedMetric.Builder setCalculatedMetricIdBytes(ByteString value)

Output only. The ID to use for the calculated metric. In the UI, this is referred to as the "API name."

The calculated_metric_id is used when referencing this calculated metric from external APIs. For example, "calcMetric:{calculated_metric_id}".

string calculated_metric_id = 4 [(.google.api.field_behavior) = OUTPUT_ONLY];

Parameter
NameDescription
valueByteString

The bytes for calculatedMetricId to set.

Returns
TypeDescription
CalculatedMetric.Builder

This builder for chaining.

setDescription(String value)

public CalculatedMetric.Builder setDescription(String value)

Optional. Description for this calculated metric. Max length of 4096 characters.

string description = 2 [(.google.api.field_behavior) = OPTIONAL];

Parameter
NameDescription
valueString

The description to set.

Returns
TypeDescription
CalculatedMetric.Builder

This builder for chaining.

setDescriptionBytes(ByteString value)

public CalculatedMetric.Builder setDescriptionBytes(ByteString value)

Optional. Description for this calculated metric. Max length of 4096 characters.

string description = 2 [(.google.api.field_behavior) = OPTIONAL];

Parameter
NameDescription
valueByteString

The bytes for description to set.

Returns
TypeDescription
CalculatedMetric.Builder

This builder for chaining.

setDisplayName(String value)

public CalculatedMetric.Builder setDisplayName(String value)

Required. Display name for this calculated metric as shown in the Google Analytics UI. Max length 82 characters.

string display_name = 3 [(.google.api.field_behavior) = REQUIRED];

Parameter
NameDescription
valueString

The displayName to set.

Returns
TypeDescription
CalculatedMetric.Builder

This builder for chaining.

setDisplayNameBytes(ByteString value)

public CalculatedMetric.Builder setDisplayNameBytes(ByteString value)

Required. Display name for this calculated metric as shown in the Google Analytics UI. Max length 82 characters.

string display_name = 3 [(.google.api.field_behavior) = REQUIRED];

Parameter
NameDescription
valueByteString

The bytes for displayName to set.

Returns
TypeDescription
CalculatedMetric.Builder

This builder for chaining.

setField(Descriptors.FieldDescriptor field, Object value)

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

setFormula(String value)

public CalculatedMetric.Builder setFormula(String value)

Required. The calculated metric's definition. Maximum number of unique referenced custom metrics is 5. Formulas supports the following operations:

  • (addition), - (subtraction), - (negative), * (multiplication), / (division), () (parenthesis). Any valid real numbers are acceptable that fit in a Long (64bit integer) or a Double (64 bit floating point number). Example formula: "( customEvent:parameter_name + cartPurchaseQuantity ) / 2.0"

string formula = 7 [(.google.api.field_behavior) = REQUIRED];

Parameter
NameDescription
valueString

The formula to set.

Returns
TypeDescription
CalculatedMetric.Builder

This builder for chaining.

setFormulaBytes(ByteString value)

public CalculatedMetric.Builder setFormulaBytes(ByteString value)

Required. The calculated metric's definition. Maximum number of unique referenced custom metrics is 5. Formulas supports the following operations:

  • (addition), - (subtraction), - (negative), * (multiplication), / (division), () (parenthesis). Any valid real numbers are acceptable that fit in a Long (64bit integer) or a Double (64 bit floating point number). Example formula: "( customEvent:parameter_name + cartPurchaseQuantity ) / 2.0"

string formula = 7 [(.google.api.field_behavior) = REQUIRED];

Parameter
NameDescription
valueByteString

The bytes for formula to set.

Returns
TypeDescription
CalculatedMetric.Builder

This builder for chaining.

setInvalidMetricReference(boolean value)

public CalculatedMetric.Builder setInvalidMetricReference(boolean value)

Output only. If true, this calculated metric has a invalid metric reference. Anything using a calculated metric with invalid_metric_reference set to true may fail, produce warnings, or produce unexpected results.

bool invalid_metric_reference = 9 [(.google.api.field_behavior) = OUTPUT_ONLY];

Parameter
NameDescription
valueboolean

The invalidMetricReference to set.

Returns
TypeDescription
CalculatedMetric.Builder

This builder for chaining.

setMetricUnit(CalculatedMetric.MetricUnit value)

public CalculatedMetric.Builder setMetricUnit(CalculatedMetric.MetricUnit value)

Required. The type for the calculated metric's value.

.google.analytics.admin.v1alpha.CalculatedMetric.MetricUnit metric_unit = 5 [(.google.api.field_behavior) = REQUIRED];

Parameter
NameDescription
valueCalculatedMetric.MetricUnit

The metricUnit to set.

Returns
TypeDescription
CalculatedMetric.Builder

This builder for chaining.

setMetricUnitValue(int value)

public CalculatedMetric.Builder setMetricUnitValue(int value)

Required. The type for the calculated metric's value.

.google.analytics.admin.v1alpha.CalculatedMetric.MetricUnit metric_unit = 5 [(.google.api.field_behavior) = REQUIRED];

Parameter
NameDescription
valueint

The enum numeric value on the wire for metricUnit to set.

Returns
TypeDescription
CalculatedMetric.Builder

This builder for chaining.

setName(String value)

public CalculatedMetric.Builder setName(String value)

Output only. Resource name for this CalculatedMetric. Format: 'properties/{property_id}/calculatedMetrics/{calculated_metric_id}'

string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY];

Parameter
NameDescription
valueString

The name to set.

Returns
TypeDescription
CalculatedMetric.Builder

This builder for chaining.

setNameBytes(ByteString value)

public CalculatedMetric.Builder setNameBytes(ByteString value)

Output only. Resource name for this CalculatedMetric. Format: 'properties/{property_id}/calculatedMetrics/{calculated_metric_id}'

string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY];

Parameter
NameDescription
valueByteString

The bytes for name to set.

Returns
TypeDescription
CalculatedMetric.Builder

This builder for chaining.

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

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

setRestrictedMetricType(int index, CalculatedMetric.RestrictedMetricType value)

public CalculatedMetric.Builder setRestrictedMetricType(int index, CalculatedMetric.RestrictedMetricType value)

Output only. Types of restricted data that this metric contains.

repeated .google.analytics.admin.v1alpha.CalculatedMetric.RestrictedMetricType restricted_metric_type = 6 [(.google.api.field_behavior) = OUTPUT_ONLY];

Parameters
NameDescription
indexint

The index to set the value at.

valueCalculatedMetric.RestrictedMetricType

The restrictedMetricType to set.

Returns
TypeDescription
CalculatedMetric.Builder

This builder for chaining.

setRestrictedMetricTypeValue(int index, int value)

public CalculatedMetric.Builder setRestrictedMetricTypeValue(int index, int value)

Output only. Types of restricted data that this metric contains.

repeated .google.analytics.admin.v1alpha.CalculatedMetric.RestrictedMetricType restricted_metric_type = 6 [(.google.api.field_behavior) = OUTPUT_ONLY];

Parameters
NameDescription
indexint

The index to set the value at.

valueint

The enum numeric value on the wire for restrictedMetricType to set.

Returns
TypeDescription
CalculatedMetric.Builder

This builder for chaining.

setUnknownFields(UnknownFieldSet unknownFields)

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