public interface

DynamicBuilders.DynamicDuration

implements DynamicBuilders.DynamicType

 androidx.wear.protolayout.expression.DynamicBuilders.DynamicDuration

Overview

Interface defining a dynamic duration type.

Summary

Methods
public static DynamicBuilders.DynamicDurationfrom(DynamicDataKey<DynamicBuilders.DynamicDuration> dynamicDataKey)

Creates a DynamicBuilders.DynamicDuration that is bound to the value of an item of the State.

public static DynamicBuilders.DynamicDurationfromByteArray(byte[] byteArray[])

Creates a DynamicBuilders.DynamicDuration from a byte array generated by DynamicBuilders.DynamicDuration.toDynamicDurationByteArray().

public static DynamicBuilders.DynamicDurationfromByteArray(byte[] byteArray[], int offset, int length)

Creates a DynamicBuilders.DynamicDuration from the provided byte array at the provided offset and length, that was generated by one of the DynamicBuilders.DynamicDuration.toDynamicDurationByteArray() overloads.

public FingerprintgetFingerprint()

Get the fingerprint for this object or null if unknown.

public DynamicBuilders.DynamicInt32getHoursPart()

Returns the number of hours part in the duration as a DynamicBuilders.DynamicInt32.

public DynamicBuilders.DynamicInt32getIntDaysPart()

Returns the total number of days in a duration as a DynamicBuilders.DynamicInt32.

public DynamicBuilders.DynamicInt32getMinutesPart()

Returns the number of minutes part in the duration as a DynamicBuilders.DynamicInt32.

public DynamicBuilders.DynamicInt32getSecondsPart()

Returns the number of seconds part in the duration as a DynamicBuilders.DynamicInt32.

public static ConditionScopes.ConditionScope<DynamicBuilders.DynamicDuration, java.time.Duration>onCondition(DynamicBuilders.DynamicBool condition)

Bind the value of this DynamicBuilders.DynamicDuration to the result of a conditional expression.

public byte[]toDynamicDurationByteArray()

Serializes the DynamicBuilders.DynamicDuration into a new byte array that can later be used with DynamicBuilders.DynamicDuration.fromByteArray(byte[]).

public inttoDynamicDurationByteArray(byte[] byteArray[])

Serializes the DynamicBuilders.DynamicDuration into the provided byte array, returning the amount of bytes written, that can later be used with DynamicDuration.fromByteArray( byteArray, 0, bytesWritten).

public inttoDynamicDurationByteArray(byte[] byteArray[], int offset, int length)

Serializes the DynamicBuilders.DynamicDuration into the provided byte array, returning the amount of bytes written, limited by the provided offset and length, that can later be used with DynamicDuration.fromByteArray(byteArray, offset, bytesWritten).

public DynamicProto.DynamicDurationtoDynamicDurationProto()

Get the protocol buffer representation of this object, without fingerprint.

public DynamicProto.DynamicDurationtoDynamicDurationProto(boolean withFingerprint)

Get the protocol buffer representation of this object, with or without fingerprint.

public DynamicBuilders.DynamicInt32toIntDays()

Returns the total number of days in a DynamicBuilders.DynamicDuration as a DynamicBuilders.DynamicInt32.

public DynamicBuilders.DynamicInt32toIntHours()

Returns the total number of hours in a DynamicBuilders.DynamicDuration as a DynamicBuilders.DynamicInt32.

public DynamicBuilders.DynamicInt32toIntMinutes()

Returns the total number of minutes in a DynamicBuilders.DynamicDuration as a DynamicBuilders.DynamicInt32.

public DynamicBuilders.DynamicInt32toIntSeconds()

Returns the total number of seconds in a DynamicBuilders.DynamicDuration as a DynamicBuilders.DynamicInt32.

public static DynamicBuilders.DynamicDurationwithSecondsPrecision(java.time.Duration duration)

Creates a constant-valued DynamicBuilders.DynamicDuration from a java.time.Duration.

Methods

public DynamicProto.DynamicDuration toDynamicDurationProto()

Get the protocol buffer representation of this object, without fingerprint.

public DynamicProto.DynamicDuration toDynamicDurationProto(boolean withFingerprint)

Get the protocol buffer representation of this object, with or without fingerprint.

public static DynamicBuilders.DynamicDuration fromByteArray(byte[] byteArray[])

Creates a DynamicBuilders.DynamicDuration from a byte array generated by DynamicBuilders.DynamicDuration.toDynamicDurationByteArray().

public static DynamicBuilders.DynamicDuration fromByteArray(byte[] byteArray[], int offset, int length)

Creates a DynamicBuilders.DynamicDuration from the provided byte array at the provided offset and length, that was generated by one of the DynamicBuilders.DynamicDuration.toDynamicDurationByteArray() overloads.

public byte[] toDynamicDurationByteArray()

Serializes the DynamicBuilders.DynamicDuration into a new byte array that can later be used with DynamicBuilders.DynamicDuration.fromByteArray(byte[]).

public int toDynamicDurationByteArray(byte[] byteArray[])

Serializes the DynamicBuilders.DynamicDuration into the provided byte array, returning the amount of bytes written, that can later be used with DynamicDuration.fromByteArray( byteArray, 0, bytesWritten).

public int toDynamicDurationByteArray(byte[] byteArray[], int offset, int length)

Serializes the DynamicBuilders.DynamicDuration into the provided byte array, returning the amount of bytes written, limited by the provided offset and length, that can later be used with DynamicDuration.fromByteArray(byteArray, offset, bytesWritten).

public static DynamicBuilders.DynamicDuration from(DynamicDataKey<DynamicBuilders.DynamicDuration> dynamicDataKey)

Creates a DynamicBuilders.DynamicDuration that is bound to the value of an item of the State.

Parameters:

dynamicDataKey: The source key to a DynamicDataBuilders.DynamicDataValue with an java.time.Duration value.

public static DynamicBuilders.DynamicDuration withSecondsPrecision(java.time.Duration duration)

Creates a constant-valued DynamicBuilders.DynamicDuration from a java.time.Duration. If java.time.Duration precision is greater than seconds, then any excess precision information will be dropped.

public DynamicBuilders.DynamicInt32 toIntDays()

Returns the total number of days in a DynamicBuilders.DynamicDuration as a DynamicBuilders.DynamicInt32. The fraction part of the result will be truncated. This is based on the standard definition of a day as 24 hours. As an example, the following is equal to DynamicInt32.constant(1)

   DynamicInstant.withSecondsPrecision(Instant.EPOCH)
      .durationUntil(DynamicInstant.withSecondsPrecision(Instant.ofEpochSecond(123456L)))
      .toIntDays();
 

Returns:

a new instance of DynamicBuilders.DynamicInt32 containing the result of the operation. Integer overflow can occur if the result of the operation is larger than MAX_VALUE.

public DynamicBuilders.DynamicInt32 toIntHours()

Returns the total number of hours in a DynamicBuilders.DynamicDuration as a DynamicBuilders.DynamicInt32. The fraction part of the result will be truncated. As an example, the following is equal to DynamicInt32.constant(34)

   DynamicInstant.withSecondsPrecision(Instant.EPOCH)
      .durationUntil(DynamicInstant.withSecondsPrecision(Instant.ofEpochSecond(123456L)))
      .toIntHours();
 

Returns:

a new instance of DynamicBuilders.DynamicInt32 containing the result of the operation. Integer overflow can occur if the result of the operation is larger than MAX_VALUE.

public DynamicBuilders.DynamicInt32 toIntMinutes()

Returns the total number of minutes in a DynamicBuilders.DynamicDuration as a DynamicBuilders.DynamicInt32. The fraction part of the result will be truncated. As an example, the following is equal to DynamicInt32.constant(2057)

   DynamicInstant.withSecondsPrecision(Instant.EPOCH)
      .durationUntil(DynamicInstant.withSecondsPrecision(Instant.ofEpochSecond(123456L)))
      .toIntMinutes();
 

Returns:

a new instance of DynamicBuilders.DynamicInt32 containing the result of the operation. Integer overflow can occur if the result of the operation is larger than MAX_VALUE.

public DynamicBuilders.DynamicInt32 toIntSeconds()

Returns the total number of seconds in a DynamicBuilders.DynamicDuration as a DynamicBuilders.DynamicInt32. As an example, the following is equal to DynamicInt32.constant(123456)

   DynamicInstant.withSecondsPrecision(Instant.EPOCH)
      .durationUntil(DynamicInstant.withSecondsPrecision(Instant.ofEpochSecond(123456L)))
      .toIntSeconds();
 

Returns:

a new instance of DynamicBuilders.DynamicInt32 containing the result of the operation. Integer overflow can occur if the result of the operation is larger than MAX_VALUE.

public DynamicBuilders.DynamicInt32 getIntDaysPart()

Returns the total number of days in a duration as a DynamicBuilders.DynamicInt32. This represents the absolute value of the total number of days in the duration based on the 24 hours day definition. The fraction part of the result will be truncated; As an example, the following is equal to DynamicInt32.constant(1)

   DynamicInstant.withSecondsPrecision(Instant.EPOCH)
      .durationUntil(DynamicInstant.withSecondsPrecision(Instant.ofEpochSecond(123456L)))
      .getIntDaysPart();
 

Returns:

a new instance of DynamicBuilders.DynamicInt32 containing the result of the operation. Integer overflow can occur if the result of the operation is larger than MAX_VALUE.

public DynamicBuilders.DynamicInt32 getHoursPart()

Returns the number of hours part in the duration as a DynamicBuilders.DynamicInt32. This represents the absolute value of remaining hours when dividing total hours by hours in a day (24 hours); As an example, the following is equal to DynamicInt32.constant(10)

   DynamicInstant.withSecondsPrecision(Instant.EPOCH)
      .durationUntil(DynamicInstant.withSecondsPrecision(Instant.ofEpochSecond(123456L)))
      .getHoursPart();
 

Returns:

a new instance of DynamicBuilders.DynamicInt32 containing the result of the operation.

public DynamicBuilders.DynamicInt32 getMinutesPart()

Returns the number of minutes part in the duration as a DynamicBuilders.DynamicInt32. This represents the absolute value of remaining minutes when dividing total minutes by minutes in an hour (60 minutes). As an example, the following is equal to DynamicInt32.constant(17)

   DynamicInstant.withSecondsPrecision(Instant.EPOCH)
      .durationUntil(DynamicInstant.withSecondsPrecision(Instant.ofEpochSecond(123456L)))
      .getMinutesPart();
 

Returns:

a new instance of DynamicBuilders.DynamicInt32 containing the result of the operation.

public DynamicBuilders.DynamicInt32 getSecondsPart()

Returns the number of seconds part in the duration as a DynamicBuilders.DynamicInt32. This represents the absolute value of remaining seconds when dividing total seconds by seconds in a minute (60 seconds); As an example, the following is equal to DynamicInt32.constant(36)

   DynamicInstant.withSecondsPrecision(Instant.EPOCH)
      .durationUntil(DynamicInstant.withSecondsPrecision(Instant.ofEpochSecond(123456L)))
      .getSecondsPart();
 

Returns:

a new instance of DynamicBuilders.DynamicInt32 containing the result of the operation.

public static ConditionScopes.ConditionScope<DynamicBuilders.DynamicDuration, java.time.Duration> onCondition(DynamicBuilders.DynamicBool condition)

Bind the value of this DynamicBuilders.DynamicDuration to the result of a conditional expression. This will use the value given in either ConditionScopes.ConditionScope.use(T) or ConditionScopes.IfTrueScope.elseUse(T) depending on the value yielded from condition.

public Fingerprint getFingerprint()

Get the fingerprint for this object or null if unknown.