com.yandex.metrica.profile
Class BirthDateAttribute
java.lang.Object
com.yandex.metrica.profile.BirthDateAttribute
public class BirthDateAttribute
extends java.lang.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 and Description |
---|---|
UserProfileUpdate<? extends com.yandex.metrica.impl.profile.UserProfileUpdatePatcher> | withAge(int age)
Updates the birth date attribute with the specified value.
|
UserProfileUpdate<? extends com.yandex.metrica.impl.profile.UserProfileUpdatePatcher> | withAgeIfUndefined(int age)
Updates the birth date attribute with the specified value only if the attribute value is undefined.
|
UserProfileUpdate<? extends com.yandex.metrica.impl.profile.UserProfileUpdatePatcher> | withBirthDate(java.util.Calendar date)
Updates the birth date attribute with the specified value.
|
UserProfileUpdate<? extends com.yandex.metrica.impl.profile.UserProfileUpdatePatcher> | withBirthDate(int year)
Updates the birth date attribute with the specified value.
|
UserProfileUpdate<? extends com.yandex.metrica.impl.profile.UserProfileUpdatePatcher> | withBirthDate(int year, int month)
Updates the birth date attribute with the specified values.
|
UserProfileUpdate<? extends com.yandex.metrica.impl.profile.UserProfileUpdatePatcher> | withBirthDate(int year, int month, int dayOfMonth)
Updates the birth date attribute with the specified values.
|
UserProfileUpdate<? extends com.yandex.metrica.impl.profile.UserProfileUpdatePatcher> | withBirthDateIfUndefined(java.util.Calendar date)
Updates the birth date attribute with the specified value only if the attribute value is undefined.
|
UserProfileUpdate<? extends com.yandex.metrica.impl.profile.UserProfileUpdatePatcher> | withBirthDateIfUndefined(int year)
Updates the birth date attribute with the specified value only if the attribute value is undefined.
|
UserProfileUpdate<? extends com.yandex.metrica.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 com.yandex.metrica.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 com.yandex.metrica.impl.profile.UserProfileUpdatePatcher> | withValueReset()
Resets the birth date attribute value.
|
Method Detail
withBirthDate
public UserProfileUpdate<? extends com.yandex.metrica.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 com.yandex.metrica.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 com.yandex.metrica.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 birthmonth
- Month of birth- Returns:
- The
UserProfileUpdate
object
withBirthDateIfUndefined
public UserProfileUpdate<? extends com.yandex.metrica.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 birthmonth
- Month of birth- Returns:
- The
UserProfileUpdate
object
withBirthDate
public UserProfileUpdate<? extends com.yandex.metrica.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 birthmonth
- Month of birthdayOfMonth
- Day of the month of birth- Returns:
- The
UserProfileUpdate
object
withBirthDateIfUndefined
public UserProfileUpdate<? extends com.yandex.metrica.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 birthmonth
- Month of birthdayOfMonth
- Day of the month of birth- Returns:
- The
UserProfileUpdate
object
withAge
public UserProfileUpdate<? extends com.yandex.metrica.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 com.yandex.metrica.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 com.yandex.metrica.impl.profile.UserProfileUpdatePatcher> withBirthDate(@NonNull java.util.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 com.yandex.metrica.impl.profile.UserProfileUpdatePatcher> withBirthDateIfUndefined(@NonNull java.util.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 com.yandex.metrica.impl.profile.UserProfileUpdatePatcher> withValueReset()
Resets the birth date attribute value.
- Returns:
- The
UserProfileUpdate
object