public class Gender extends VCardProperty
Defines the person's sex.
Code sample (creating)
VCard vcard = new VCard(); Gender gender = Gender.male(); vcard.setGender(gender);
Code sample (retrieving)
VCard vcard = ... Gender gender = vcard.getGender(); if (gender.isMale()){ //gender is male } else if (gender.isFemale()){ //gender is female } //etc
Property name: GENDER
Supported versions: 4.0
Modifier and Type | Field and Description |
---|---|
static String |
FEMALE |
static String |
MALE |
static String |
NONE |
static String |
OTHER |
static String |
UNKNOWN |
group, parameters
Constructor and Description |
---|
Gender(String gender)
Creates a gender property.
|
Modifier and Type | Method and Description |
---|---|
Set<VCardVersion> |
_supportedVersions()
Gets the vCard versions that support this property.
|
protected void |
_validate(List<Warning> warnings,
VCardVersion version,
VCard vcard)
Checks the property for data consistency problems or deviations from the
spec.
|
static Gender |
female()
Creates a gender property whose value is set to "female".
|
String |
getGender()
Gets the gender value.
|
String |
getText()
Gets the additional text associated with this property.
|
boolean |
isFemale()
Determines if the gender is "female" or not.
|
boolean |
isMale()
Determines if the gender is "male" or not.
|
boolean |
isNone()
Determines if the gender is "none" or not.
|
boolean |
isOther()
Determines if the gender is "other" or not.
|
boolean |
isUnknown()
Determines if the gender is "unknown" or not.
|
static Gender |
male()
Creates a gender property whose value is set to "male".
|
static Gender |
none()
Creates a gender property whose value is set to "none".
|
static Gender |
other()
Creates a gender property whose value is set to "other".
|
void |
setGender(String gender)
Sets the gender value.
|
void |
setText(String text)
Sets the additional text associated with this property.
|
static Gender |
unknown()
Creates a gender property whose value is set to "unknown".
|
addParameter, compareTo, getGroup, getParameter, getParameters, getParameters, getSupportedVersions, removeParameter, setGroup, setParameter, setParameters, validate
public static final String MALE
public static final String FEMALE
public static final String OTHER
public static final String NONE
public static final String UNKNOWN
public Gender(String gender)
gender
- the gender value (e.g. "F")public Set<VCardVersion> _supportedVersions()
VCardProperty
Gets the vCard versions that support this property.
This method should be overridden by child classes if the property does not support all vCard versions. The default implementation of this method returns all vCard versions.
_supportedVersions
in class VCardProperty
public String getText()
public void setText(String text)
text
- additional text or null to removepublic String getGender()
public void setGender(String gender)
gender
- the gender value (see static strings for the possible
values)public boolean isMale()
public boolean isFemale()
public boolean isOther()
public boolean isNone()
public boolean isUnknown()
public static Gender male()
public static Gender female()
public static Gender other()
public static Gender none()
public static Gender unknown()
protected void _validate(List<Warning> warnings, VCardVersion version, VCard vcard)
VCardProperty
_validate
in class VCardProperty
warnings
- the list to add the warnings toversion
- the version to check the property againstvcard
- the vCard this property belongs toThis software is published under the BSD license. Copyright © 2003-${build.year}, CRIXP AG, Switzerland, All rights reserved. Use is subject to license terms.