Class BirthDateAttribute

java.lang.Object
io.appmetrica.analytics.profile.BirthDateAttribute

public class BirthDateAttribute extends Object
The birth date attribute class. It enables linking user birth date with the profile.

Overloaded methods allow you to set an approximate date of birth for a user.

EXAMPLE:

     UserProfile userProfile = new UserProfile.Builder()
                     .apply(Attribute.birthDate().withAge(27))
                     .build();
 
  • Method Summary

    Modifier and Type
    Method
    Description
    UserProfileUpdate<? extends io.appmetrica.analytics.impl.profile.UserProfileUpdatePatcher>
    withAge(int age)
    Updates the birth date attribute with the specified value.
    UserProfileUpdate<? extends io.appmetrica.analytics.impl.profile.UserProfileUpdatePatcher>
    Updates the birth date attribute with the specified value only if the attribute value is undefined.
    UserProfileUpdate<? extends io.appmetrica.analytics.impl.profile.UserProfileUpdatePatcher>
    withBirthDate(int year)
    Updates the birth date attribute with the specified value.
    UserProfileUpdate<? extends io.appmetrica.analytics.impl.profile.UserProfileUpdatePatcher>
    withBirthDate(int year, int month)
    Updates the birth date attribute with the specified values.
    UserProfileUpdate<? extends io.appmetrica.analytics.impl.profile.UserProfileUpdatePatcher>
    withBirthDate(int year, int month, int dayOfMonth)
    Updates the birth date attribute with the specified values.
    UserProfileUpdate<? extends io.appmetrica.analytics.impl.profile.UserProfileUpdatePatcher>
    Updates the birth date attribute with the specified value.
    UserProfileUpdate<? extends io.appmetrica.analytics.impl.profile.UserProfileUpdatePatcher>
    Updates the birth date attribute with the specified value only if the attribute value is undefined.
    UserProfileUpdate<? extends io.appmetrica.analytics.impl.profile.UserProfileUpdatePatcher>
    withBirthDateIfUndefined(int year, int month)
    Updates the birth date attribute with the specified values only if the attribute value is undefined.
    UserProfileUpdate<? extends io.appmetrica.analytics.impl.profile.UserProfileUpdatePatcher>
    withBirthDateIfUndefined(int year, int month, int dayOfMonth)
    Updates the birth date attribute with the specified values only if the attribute value is undefined.
    UserProfileUpdate<? extends io.appmetrica.analytics.impl.profile.UserProfileUpdatePatcher>
    Updates the birth date attribute with the specified value only if the attribute value is undefined.
    UserProfileUpdate<? extends io.appmetrica.analytics.impl.profile.UserProfileUpdatePatcher>
    Resets the birth date attribute value.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • withBirthDate

      public UserProfileUpdate<? extends io.appmetrica.analytics.impl.profile.UserProfileUpdatePatcher> withBirthDate(int year)
      Updates the birth date attribute with the specified value. This methods sets year of the birth date.

      NOTE: It overwrites the existing value.

      Parameters:
      year - Year of birth
      Returns:
      The UserProfileUpdate object
    • withBirthDateIfUndefined

      public UserProfileUpdate<? extends io.appmetrica.analytics.impl.profile.UserProfileUpdatePatcher> withBirthDateIfUndefined(int year)
      Updates the birth date attribute with the specified value only if the attribute value is undefined. The method doesn't affect the value if it has been set earlier.

      This methods sets year of the birth date.

      Parameters:
      year - Year of birth
      Returns:
      The UserProfileUpdate object
    • withBirthDate

      public UserProfileUpdate<? extends io.appmetrica.analytics.impl.profile.UserProfileUpdatePatcher> withBirthDate(int year, int month)
      Updates the birth date attribute with the specified values. This method sets the year and month of the birth date.

      NOTE: It overwrites the existing value.

      Parameters:
      year - Year of birth
      month - Month of birth
      Returns:
      The UserProfileUpdate object
    • withBirthDateIfUndefined

      public UserProfileUpdate<? extends io.appmetrica.analytics.impl.profile.UserProfileUpdatePatcher> withBirthDateIfUndefined(int year, int month)
      Updates the birth date attribute with the specified values only if the attribute value is undefined. The method doesn't affect the value if it has been set earlier.

      This method sets the year and month of the birth date.

      Parameters:
      year - Year of birth
      month - Month of birth
      Returns:
      The UserProfileUpdate object
    • withBirthDate

      public UserProfileUpdate<? extends io.appmetrica.analytics.impl.profile.UserProfileUpdatePatcher> withBirthDate(int year, int month, int dayOfMonth)
      Updates the birth date attribute with the specified values.

      This methods sets year, month and day of the month of the birth date.

      NOTE: It overwrites the existing value.

      Parameters:
      year - Year of birth
      month - Month of birth
      dayOfMonth - Day of the month of birth
      Returns:
      The UserProfileUpdate object
    • withBirthDateIfUndefined

      public UserProfileUpdate<? extends io.appmetrica.analytics.impl.profile.UserProfileUpdatePatcher> withBirthDateIfUndefined(int year, int month, int dayOfMonth)
      Updates the birth date attribute with the specified values only if the attribute value is undefined. The method doesn't affect the value if it has been set earlier.

      This methods sets year, month and day of the month of the birth date.

      Parameters:
      year - Year of birth
      month - Month of birth
      dayOfMonth - Day of the month of birth
      Returns:
      The UserProfileUpdate object
    • withAge

      public UserProfileUpdate<? extends io.appmetrica.analytics.impl.profile.UserProfileUpdatePatcher> withAge(int age)
      Updates the birth date attribute with the specified value. It calculates the birth year by using the following formula: Birth Year = currentYear - age.

      NOTE: It overwrites the existing value.

      Parameters:
      age - Age of the user
      Returns:
      The UserProfileUpdate object
    • withAgeIfUndefined

      public UserProfileUpdate<? extends io.appmetrica.analytics.impl.profile.UserProfileUpdatePatcher> withAgeIfUndefined(int age)
      Updates the birth date attribute with the specified value only if the attribute value is undefined. The method doesn't affect the value if it has been set earlier.

      It calculates the birth year by using the following formula: Birth Year = currentYear - age.

      Parameters:
      age - Age of the user
      Returns:
      The UserProfileUpdate object
    • withBirthDate

      public UserProfileUpdate<? extends io.appmetrica.analytics.impl.profile.UserProfileUpdatePatcher> withBirthDate(@NonNull Calendar date)
      Updates the birth date attribute with the specified value.

      NOTE: It overwrites the existing value.

      Parameters:
      date - Date of birth
      Returns:
      The UserProfileUpdate object
    • withBirthDateIfUndefined

      public UserProfileUpdate<? extends io.appmetrica.analytics.impl.profile.UserProfileUpdatePatcher> withBirthDateIfUndefined(@NonNull Calendar date)
      Updates the birth date attribute with the specified value only if the attribute value is undefined. The method doesn't affect the value if it has been set earlier.
      Parameters:
      date - Date of birth
      Returns:
      The UserProfileUpdate object
    • withValueReset

      public UserProfileUpdate<? extends io.appmetrica.analytics.impl.profile.UserProfileUpdatePatcher> withValueReset()
      Resets the birth date attribute value.
      Returns:
      The UserProfileUpdate object