Class GenderAttribute

java.lang.Object
com.yandex.metrica.profile.GenderAttribute

public class GenderAttribute
extends java.lang.Object
The gender attribute class. It enables linking user gender with the profile.

Possible values:

You can set the OTHER value to the Gender attribute and pass additional info using the custom attribute.

EXAMPLE:

     
      UserProfile userProfile = new UserProfile.Builder()
                             .apply(Attribute.gender().withValue(GenderAttribute.Gender.FEMALE))
                             .build();
 
  • Nested Class Summary

    Nested Classes
    Modifier and Type Class Description
    static class  GenderAttribute.Gender
    Gender enumeration.
  • Method Summary

    Modifier and Type Method Description
    UserProfileUpdate<? extends com.yandex.metrica.impl.profile.UserProfileUpdatePatcher> withValue​(GenderAttribute.Gender value)
    Updates the gender attribute with the specified value.
    UserProfileUpdate<? extends com.yandex.metrica.impl.profile.UserProfileUpdatePatcher> withValueIfUndefined​(GenderAttribute.Gender value)
    Updates the gender attribute with the specified value only if the attribute value is undefined.
    UserProfileUpdate<? extends com.yandex.metrica.impl.profile.UserProfileUpdatePatcher> withValueReset()
    Resets the gender attribute value.

    Methods inherited from class java.lang.Object

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

    • withValue

      @NonNull public UserProfileUpdate<? extends com.yandex.metrica.impl.profile.UserProfileUpdatePatcher> withValue​(@NonNull GenderAttribute.Gender value)
      Updates the gender attribute with the specified value.

      It overwrites the existing value.

      Parameters:
      value - GenderAttribute.Gender enumeration value
      Returns:
      The UserProfileUpdate object
    • withValueIfUndefined

      @NonNull public UserProfileUpdate<? extends com.yandex.metrica.impl.profile.UserProfileUpdatePatcher> withValueIfUndefined​(@NonNull GenderAttribute.Gender value)
      Updates the gender 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:
      value - GenderAttribute.Gender enumeration value
      Returns:
      The UserProfileUpdate object
    • withValueReset

      @NonNull public UserProfileUpdate<? extends com.yandex.metrica.impl.profile.UserProfileUpdatePatcher> withValueReset()
      Resets the gender attribute value.
      Returns:
      The UserProfileUpdate object