jfxtras.icalendarfx.components.VAttendee Maven / Gradle / Ivy
package jfxtras.icalendarfx.components;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;
import jfxtras.icalendarfx.components.VComponent;
import jfxtras.icalendarfx.properties.component.relationship.Attendee;
/**
* Interface for {@link Attendee} property
*
* @author David Bal
*
* @param concrete subclass
*/
public interface VAttendee extends VComponent
{
/**
* This property defines an "Attendee" within a calendar component.
* RFC 5545 iCalendar 3.8.4.1 page 107
*
* Examples:
*
* - ATTENDEE;MEMBER="mailto:[email protected]":
* mailto:[email protected]
* - ATTENDEE;ROLE=REQ-PARTICIPANT;PARTSTAT=ACCEPTED;CN=Jane Doe
* :mailto:[email protected]
*
*
*/
List getAttendees();
void setAttendees(List properties);
/**
* Sets the value of the {@link #attendeesProperty()} }
*
* @return - this class for chaining
*/
default T withAttendees(List attendees)
{
if (getAttendees() == null)
{
setAttendees(new ArrayList<>());
}
getAttendees().addAll(attendees);
if (attendees != null)
{
attendees.forEach(c -> orderChild(c));
}
return (T) this;
}
/**
* Sets the value of the {@link #attendeesProperty()} from a vararg of {@link Attendee} objects.
*
* @return - this class for chaining
*/
default T withAttendees(Attendee...attendees)
{
return withAttendees(Arrays.asList(attendees));
}
/**
* Sets the value of the {@link #attendeesProperty()} by parsing a vararg of
* iCalendar content text representing individual {@link Attendee} objects.
*
* @return - this class for chaining
*/
default T withAttendees(String...attendees)
{
List list = Arrays.stream(attendees)
.map(c -> Attendee.parse(c))
.collect(Collectors.toList());
return withAttendees(list);
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy