|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectezvcard.types.VCardType
public abstract class VCardType
Represents a vCard key/value pair entry (called a "type" or "property").
Field Summary | |
---|---|
protected String |
group
The group that this type belongs to or null if it doesn't belong to a group. |
protected VCardSubTypes |
subTypes
The list of attributes that are associated with this type (called "sub types" or "parameters"). |
protected String |
typeName
The name of the type. |
Constructor Summary | |
---|---|
VCardType(String typeName)
|
Method Summary | |
---|---|
int |
compareTo(VCardType that)
Sorts by PREF parameter ascending. |
protected void |
doMarshalSubTypes(VCardSubTypes subTypes,
VCardVersion version,
List<String> warnings,
CompatibilityMode compatibilityMode,
VCard vcard)
Gets the sub types that will be sent over the wire. |
protected abstract void |
doMarshalText(StringBuilder value,
VCardVersion version,
List<String> warnings,
CompatibilityMode compatibilityMode)
Converts this type object to a string for sending over the wire. |
protected void |
doMarshalXml(XCardElement parent,
List<String> warnings,
CompatibilityMode compatibilityMode)
Marshals this type for inclusion in an xCard (XML document). |
protected void |
doUnmarshalHtml(HCardElement element,
List<String> warnings)
Unmarshals the type from an hCard (HTML document). |
protected abstract void |
doUnmarshalText(String value,
VCardVersion version,
List<String> warnings,
CompatibilityMode compatibilityMode)
Unmarshals the type value from off the wire. |
protected void |
doUnmarshalXml(XCardElement element,
List<String> warnings,
CompatibilityMode compatibilityMode)
Unmarshals the type from an xCard (XML document). |
String |
getGroup()
Gets this type's group. |
QName |
getQName()
Gets the qualified name (XML namespace and local part) for marshalling the type to an XML document (xCard). |
VCardSubTypes |
getSubTypes()
Gets all sub types (a.k.a "parameters") associated with this type. |
VCardVersion[] |
getSupportedVersions()
Gets the vCard versions that support this type. |
String |
getTypeName()
Gets the name of this type. |
VCardSubTypes |
marshalSubTypes(VCardVersion version,
List<String> warnings,
CompatibilityMode compatibilityMode,
VCard vcard)
Gets the Sub Types to send over the wire. |
String |
marshalText(VCardVersion version,
List<String> warnings,
CompatibilityMode compatibilityMode)
Converts this type object to a string for sending over the wire. |
void |
marshalXml(Element parent,
VCardVersion version,
List<String> warnings,
CompatibilityMode compatibilityMode)
Marshals this type for inclusion in an xCard (XML document). |
void |
setGroup(String group)
Sets this type's group. |
void |
unmarshalHtml(Element element,
List<String> warnings)
Unmarshals the type from an hCard (HTML document). |
void |
unmarshalText(VCardSubTypes subTypes,
String value,
VCardVersion version,
List<String> warnings,
CompatibilityMode compatibilityMode)
Unmarshals the type value from off the wire. |
void |
unmarshalXml(VCardSubTypes subTypes,
Element element,
VCardVersion version,
List<String> warnings,
CompatibilityMode compatibilityMode)
Unmarshals the type from an xCard (XML document). |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected final String typeName
protected String group
protected VCardSubTypes subTypes
Constructor Detail |
---|
public VCardType(String typeName)
typeName
- the type name (e.g. "ADR")Method Detail |
---|
public String getTypeName()
public VCardVersion[] getSupportedVersions()
public final String marshalText(VCardVersion version, List<String> warnings, CompatibilityMode compatibilityMode)
version
- the version vCard that is being generatedwarnings
- allows the programmer to alert the user to any
note-worthy (but non-critical) issues that occurred during the
marshalling processcompatibilityMode
- allows the programmer to customize the
marshalling process depending on the expected consumer of the vCard
SkipMeException
- if this type should NOT be marshalled into the
vCard
EmbeddedVCardException
- if the value of this type is an embedded
vCard (i.e. the AGENT type)protected abstract void doMarshalText(StringBuilder value, VCardVersion version, List<String> warnings, CompatibilityMode compatibilityMode)
value
- the buffer to add the marshalled value toversion
- the version vCard that is being generatedwarnings
- allows the programmer to alert the user to any
note-worthy (but non-critical) issues that occurred during the
marshalling processcompatibilityMode
- allows the programmer to customize the
marshalling process depending on the expected consumer of the vCard
SkipMeException
- if this type should NOT be marshalled into the
vCard
EmbeddedVCardException
- if the value of this type is an embedded
vCard (i.e. the AGENT type)public final void marshalXml(Element parent, VCardVersion version, List<String> warnings, CompatibilityMode compatibilityMode)
parent
- the XML element that the type's value will be inserted
into. For example, this would be the "<fn>" element for the "FN"
type.version
- the version vCard that is being generatedwarnings
- allows the programmer to alert the user to any
note-worthy (but non-critical) issues that occurred during the
marshalling processcompatibilityMode
- allows the programmer to customize the
marshalling process depending on the expected consumer of the vCard
SkipMeException
- if this type should NOT be marshalled into the
vCardprotected void doMarshalXml(XCardElement parent, List<String> warnings, CompatibilityMode compatibilityMode)
parent
- the XML element that the type's value will be inserted
into. For example, this would be the "<fn>" element for the "FN"
type.warnings
- allows the programmer to alert the user to any
note-worthy (but non-critical) issues that occurred during the
marshalling processcompatibilityMode
- allows the programmer to customize the
marshalling process depending on the expected consumer of the vCard
SkipMeException
- if this type should NOT be marshalled into the
vCardpublic final VCardSubTypes marshalSubTypes(VCardVersion version, List<String> warnings, CompatibilityMode compatibilityMode, VCard vcard)
version
- the version vCard that is being generatedwarnings
- allows the programmer to alert the user to any
note-worthy (but non-critical) issues that occurred during the
marshalling processcompatibilityMode
- allows the programmer to customize the
marshalling process depending on the expected consumer of the vCardvcard
- the vCard that is being marshalled
protected void doMarshalSubTypes(VCardSubTypes subTypes, VCardVersion version, List<String> warnings, CompatibilityMode compatibilityMode, VCard vcard)
If this method is NOT overridden, then the type's sub types will be sent
over the wire as-is. In other words, whatever is in the
subTypes
field will be sent. Child classes can override
this method in order to modify the sub types before they are marshalled.
subTypes
- the sub types that will be marshalled into the vCard.
This object is a copy of the subTypes
field, so any
modifications done to this object will not effect the state of the field.version
- the version vCard that is being generatedwarnings
- allows the programmer to alert the user to any
note-worthy (but non-critical) issues that occurred during the
marshalling processcompatibilityMode
- allows the programmer to customize the
marshalling process depending on the expected consumer of the vCardvcard
- the VCard
object that is being marshalledpublic final void unmarshalText(VCardSubTypes subTypes, String value, VCardVersion version, List<String> warnings, CompatibilityMode compatibilityMode)
subTypes
- the sub types that were parsedvalue
- the unfolded value from off the wire. If the wire value is
in "quoted-printable" encoding, it will be decoded.version
- the version of the vCard that is being read or null if the
VERSION type has not been parsed yet (v3.0 and v4.0 require that the
VERSION type be at the top of the vCard, but v2.1 has no such
requirement)warnings
- allows the programmer to alert the user to any
note-worthy (but non-critical) issues that occurred during the
unmarshalling processcompatibilityMode
- allows the programmer to customize the
unmarshalling process depending on where the vCard came from
SkipMeException
- if this type should NOT be added to the
VCard
object
EmbeddedVCardException
- if the value of this type is an embedded
vCard (i.e. the AGENT type)protected abstract void doUnmarshalText(String value, VCardVersion version, List<String> warnings, CompatibilityMode compatibilityMode)
value
- the unfolded value from off the wire. If the wire value is
in the "quoted-printable" encoding, it will be decoded.version
- the version of the vCard that is being read or null if the
VERSION type has not been parsed yet (v3.0 and v4.0 require that the
VERSION type be at the top of the vCard, but v2.1 has no such
requirement)warnings
- allows the programmer to alert the user to any
note-worthy (but non-critical) issues that occurred during the
unmarshalling processcompatibilityMode
- allows you to customize the unmarshalling
process depending on where the vCard came from
SkipMeException
- if this type should NOT be added to the
VCard
object
EmbeddedVCardException
- if the value of this type is an embedded
vCard (i.e. the AGENT type)public final void unmarshalXml(VCardSubTypes subTypes, Element element, VCardVersion version, List<String> warnings, CompatibilityMode compatibilityMode)
subTypes
- the sub types that were parsedelement
- the XML element that contains the type data. For example,
this would be the "<fn>" element for the "FN" type. This object
will NOT include the "<parameters>" child element (it is removed
after being unmarshalled into a VCardSubTypes
object).version
- the version of the xCardwarnings
- allows the programmer to alert the user to any
note-worthy (but non-critical) issues that occurred during the
unmarshalling processcompatibilityMode
- allows the programmer to customize the
unmarshalling process depending on where the vCard came from
SkipMeException
- if this type should NOT be added to the
VCard
object
UnsupportedOperationException
- if the type class does not support
xCard parsingprotected void doUnmarshalXml(XCardElement element, List<String> warnings, CompatibilityMode compatibilityMode)
element
- the XML element that contains the type data. For example,
this would be the "<fn>" element for the "FN" type. This object
will NOT include the "<parameters>" child element (it is removed
after being unmarshalled into a VCardSubTypes
object).warnings
- allows the programmer to alert the user to any
note-worthy (but non-critical) issues that occurred during the
unmarshalling processcompatibilityMode
- allows the programmer to customize the
unmarshalling process depending on where the vCard came from
SkipMeException
- if this type should NOT be added to the
VCard
object
UnsupportedOperationException
- if the type class does not support
xCard parsingpublic final void unmarshalHtml(Element element, List<String> warnings)
element
- the HTML element that contains the type data.warnings
- allows the programmer to alert the user to any
note-worthy (but non-critical) issues that occurred during the
unmarshalling process
SkipMeException
- if this type should NOT be added to the
VCard
object
EmbeddedVCardException
- if the value of this type is an embedded
vCard (i.e. the AGENT type)
UnsupportedOperationException
- if the type class does not support
hCard parsingprotected void doUnmarshalHtml(HCardElement element, List<String> warnings)
element
- the HTML element that contains the type data.warnings
- allows the programmer to alert the user to any
note-worthy (but non-critical) issues that occurred during the
unmarshalling process
SkipMeException
- if this type should NOT be added to the
VCard
object
EmbeddedVCardException
- if the value of this type is an embedded
vCard (i.e. the AGENT type)public QName getQName()
Gets the qualified name (XML namespace and local part) for marshalling the type to an XML document (xCard).
Extended type classes should override this method. By default, this
method returns null
, which instructs the marshallers to
assign the following qualified name to the type:
Namespace: xCard namespace
Local part: a lower-cased version of the type name
public VCardSubTypes getSubTypes()
Ideally, this method should NOT be used to retrieve the values of
standard sub types because the type class should contain getter/setter
methods for each standard sub type. For example, instead of calling
NoteType.getSubTypes().getLanguage()
to retrieve the
"LANGUAGE" sub type of a NOTE, the NoteType.getLanguage()
method
should be called instead.
public String getGroup()
public void setGroup(String group)
group
- the group or null to remove the type's grouppublic int compareTo(VCardType that)
compareTo
in interface Comparable<VCardType>
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |