VCard

class VCard(formattedName: String? = null)

Object that represents a vCard

Each vCard is required to have at least one FN property so the value for the first FN property can be directly passed through this constructor.

val arthur = VCard("Arthur Dent")

If no value is passed then no FN property is added to the vCard. In this case the FN property is added during the export to be a valid vCard.

val emptyCard = VCard()

The FN property could also be added later.

val arthur = VCard()
.property(Fn("Arthur Dent"))

To simplify the creation of vCard objects with properties the property method can also be chained:

val arthur = VCard()
.property(Fn("Arthur Dent"))
.property(N("Dent", "Arthur", "Philip")
.property(Categories("human", "male"))

Parameters

formattedName

the value for the first FN property

Constructors

Link copied to clipboard
constructor(formattedName: String? = null)

If given a value, automatically creates an FN property.

Functions

Link copied to clipboard
open operator override fun equals(other: Any?): Boolean

Indicates whether some other object is "equal to" this vCard.

Link copied to clipboard
fun <P : Property<*>> get(propertyClass: KClass<P>): List<P>

Retuns a list of properties of the given type/class in this vCard.

Link copied to clipboard
fun getName(easternNameOrder: Boolean = false): String

Convenience method to get have a quick and easy method to get a human-readable name of this card. If the Property "N" is present a Name is build based on the values. The Order of the given and family names can be chosen by the parameter ```easternNameOrder``. If this parameter is set to true, the family names are put before the given names.

Link copied to clipboard
fun <P : Property<*>> has(propertyClass: KClass<P>): Boolean

Checks weather there is a property of the given type/class in this vCard.

Link copied to clipboard
open override fun hashCode(): Int

Returns the hash code value for the vCard.

Link copied to clipboard
fun property(property: Property<*>): VCard

Adds the given property to the vCard.

Link copied to clipboard
open override fun toString(): String

Returns a formatted string of this vCard according to RFC 6350 with all mandatory values. If no FN property is present an empty FN be added to the string because it is a mandatory field.