public class Version extends ICalProperty
Defines the min/max iCalendar versions a consumer must support in order to successfully parse the iCalendar object.
Code sample:
ICalendar ical = new ICalendar(); //all ICalendar objects are given a VERSION property on creation ical.getVersion(); //"2.0" //get the default iCal version Version version = Version.v2_0(); ical.setVersion(version);
Modifier and Type | Field and Description |
---|---|
static VersionNumber |
ICAL |
static VersionNumber |
VCAL |
parameters
Constructor and Description |
---|
Version(ICalVersion version)
Creates a new version property.
|
Version(String version)
Creates a new version property.
|
Version(String minVersion,
String maxVersion)
Creates a new version property.
|
Modifier and Type | Method and Description |
---|---|
VersionNumber |
getMaxVersion()
Gets the maximum version that a consumer must support in order to
successfully parse the iCalendar object.
|
VersionNumber |
getMinVersion()
Gets the minimum version that a consumer must support in order to
successfully parse the iCalendar object.
|
boolean |
isV1_0()
Determines if this property is set to the older vCalendar version.
|
boolean |
isV2_0()
Determines if this property is set to the latest iCalendar version.
|
void |
setMaxVersion(VersionNumber maxVersion)
Sets the maximum version that a consumer must support in order to
successfully parse the iCalendar object.
|
void |
setMinVersion(VersionNumber minVersion)
Sets the minimum version that a consumer must support in order to
successfully parse the iCalendar object.
|
ICalVersion |
toICalVersion()
Converts this property's value to an
ICalVersion enum. |
static Version |
v1_0()
Creates a version property that is set to the older vCalendar version
(1.0).
|
static Version |
v2_0()
Creates a version property that is set to the latest iCalendar version
(2.0).
|
protected void |
validate(List<ICalComponent> components,
ICalVersion version,
List<Warning> warnings)
Checks the property for data consistency problems or deviations from the
spec.
|
addParameter, getParameter, getParameters, getParameters, removeParameter, setParameter, setParameter, setParameters, validate
public static final VersionNumber VCAL
public static final VersionNumber ICAL
public Version(ICalVersion version)
version
- the version that a consumer must support in order to
successfully parse the iCalendar objectpublic Version(String version)
version
- the version that a consumer must support in order to
successfully parse the iCalendar objectIllegalArgumentException
- if the version string is invalidpublic Version(String minVersion, String maxVersion)
minVersion
- the minimum version that a consumer must support in
order to successfully parse the iCalendar objectmaxVersion
- the maximum version that a consumer must support in
order to successfully parse the iCalendar objectIllegalArgumentException
- if one of the versions strings are
invalidpublic static Version v1_0()
public static Version v2_0()
public boolean isV1_0()
public boolean isV2_0()
public VersionNumber getMinVersion()
public void setMinVersion(VersionNumber minVersion)
minVersion
- the minimum version or null to removepublic VersionNumber getMaxVersion()
public void setMaxVersion(VersionNumber maxVersion)
maxVersion
- the maximum version (this field is required)public ICalVersion toICalVersion()
ICalVersion
enum.ICalVersion
enum or null if it couldn't be convertedprotected void validate(List<ICalComponent> components, ICalVersion version, List<Warning> warnings)
ICalProperty
Checks the property for data consistency problems or deviations from the spec.
This method should be overridden by child classes that wish to provide validation logic. The default implementation of this method does nothing.
validate
in class ICalProperty
components
- the hierarchy of components that the property belongs
toversion
- the version to validate againstwarnings
- the list to add the warnings toCopyright © 2013-2015 Michael Angstadt. All Rights Reserved.