|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectbiweekly.ValidationWarnings
public class ValidationWarnings
Holds the validation warnings of an iCalendar object.
Examples:
//validate an iCalendar object ValidationWarnings warnings = ical.validate(); //print all warnings to a string: System.out.println(warnings.toString()); //sample output: //[ICalendar]: ProductId is not set (it is a required property). //[ICalendar > VEvent > DateStart]: DateStart must come before DateEnd. //[ICalendar > VEvent > VAlarm]: The trigger must specify which date field its duration is relative to. //iterate over each warnings group //this gives you access to the property/component object and its parent components for (WarningsGroup group : warnings) { ICalProperty prop = group.getProperty(); if (prop == null) { //then it was a component that caused the warnings ICalComponent comp = group.getComponent(); } //get parent components List<ICalComponent> hierarchy = group.getComponentHierarchy(); //get warning messages List<String> messages = group.getMessages(); } //you can also get the warnings of specific properties/components List<WarningsGroup> dtstartWarnings = warnings.getByProperty(DateStart.class); List<WarningsGroup> veventWarnings = warnings.getByComponent(VEvent.class);
ICalendar.validate()
Nested Class Summary | |
---|---|
static class |
ValidationWarnings.WarningsGroup
Holds the validation warnings of a property or component. |
Constructor Summary | |
---|---|
ValidationWarnings(List<ValidationWarnings.WarningsGroup> warnings)
Creates a new validation warnings list. |
Method Summary | |
---|---|
List<ValidationWarnings.WarningsGroup> |
getByComponent(Class<? extends ICalComponent> componentClass)
Gets all validation warnings of a given component. |
List<ValidationWarnings.WarningsGroup> |
getByProperty(Class<? extends ICalProperty> propertyClass)
Gets all validation warnings of a given property. |
List<ValidationWarnings.WarningsGroup> |
getWarnings()
Gets all the validation warnings. |
boolean |
isEmpty()
Determines whether there are any validation warnings. |
Iterator<ValidationWarnings.WarningsGroup> |
iterator()
Iterates over each warning group (same as calling getWarnings().iterator() ). |
String |
toString()
Outputs all validation warnings as a newline-delimited string. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public ValidationWarnings(List<ValidationWarnings.WarningsGroup> warnings)
warnings
- the validation warningsMethod Detail |
---|
public List<ValidationWarnings.WarningsGroup> getByProperty(Class<? extends ICalProperty> propertyClass)
propertyClass
- the property (e.g. DateStart.class
)
public List<ValidationWarnings.WarningsGroup> getByComponent(Class<? extends ICalComponent> componentClass)
componentClass
- the component (e.g. VEvent.class
)
public List<ValidationWarnings.WarningsGroup> getWarnings()
public boolean isEmpty()
public String toString()
Outputs all validation warnings as a newline-delimited string. For example:
[ICalendar]: ProductId is not set (it is a required property). [ICalendar > VEvent > DateStart]: DateStart must come before DateEnd. [ICalendar > VEvent > VAlarm]: The trigger must specify which date field its duration is relative to.
toString
in class Object
public Iterator<ValidationWarnings.WarningsGroup> iterator()
getWarnings().iterator()
).
iterator
in interface Iterable<ValidationWarnings.WarningsGroup>
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |