jfxtras.icalendarfx.components.VDescribable 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.descriptive.Attachment;
import jfxtras.icalendarfx.properties.component.descriptive.Summary;
/**
* {@link VComponent} with the following properties
*
* - {@link Attachment ATTACH}
*
- {@link Summary SUMMARY}
*
*
*
* @author David Bal
*/
public interface VDescribable extends VComponent
{
/**
* This property provides the capability to associate a
* document object with a calendar component.
*
*Example: The following is an example of this property:
*
*- ATTACH:CID:[email protected]
*
- ATTACH;FMTTYPE=application/postscript:ftp://example.com/pub/
* reports/r-960812.ps
*
*
*/
List> getAttachments();
void setAttachments(List> properties);
/**
* Sets the value of the {@link #attachmentsProperty()}.
*
* @return - this class for chaining
*/
default T withAttachments(List> attachments)
{
if (getAttachments() == null)
{
setAttachments(new ArrayList<>());
}
getAttachments().addAll(attachments);
if (attachments != null)
{
attachments.forEach(c -> orderChild(c));
}
return (T) this;
}
/**
* Sets the value of the {@link #attachmentsProperty()} by parsing a vararg of
* iCalendar content text representing individual {@link Attachment} objects.
*
* @return - this class for chaining
*/
default T withAttachments(String...attachments)
{
List> list = Arrays.stream(attachments)
.map(c -> (Attachment>) Attachment.parse(c))
.collect(Collectors.toList());
return withAttachments(list);
}
/**
* Sets the value of the {@link #attachmentsProperty()} from a vararg of {@link Attachment} objects.
*
* @return - this class for chaining
*/
default T withAttachments(Attachment>...attachments)
{
return withAttachments(Arrays.asList(attachments));
}
/**
*This property defines a short summary or subject for the calendar component
*
*Example: The following is an example of this property:
*
*- SUMMARY:Department Party
*
*
*/
Summary getSummary();
default void setSummary(String summary)
{
setSummary(Summary.parse(summary));
}
void setSummary(Summary summary);
/**
* Sets the value of the {@link #summaryProperty()}
*
* @return - this class for chaining
*/
default T withSummary(Summary summary)
{
setSummary(summary);
return (T) this;
}
/**
* Sets the value of the {@link #summaryProperty()} by parsing iCalendar content text.
*
* @return - this class for chaining
*/
default T withSummary(String summary)
{
setSummary(summary);
return (T) this;
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy