All Downloads are FREE. Search and download functionalities are using the official Maven repository.

jfxtras.icalendarfx.content.SingleLineContent Maven / Gradle / Ivy

There is a newer version: 17-r1
Show newest version
package jfxtras.icalendarfx.content;

import java.util.stream.Collectors;

import jfxtras.icalendarfx.utilities.Callback;

public class SingleLineContent extends ContentLineBase
{
    final private int builderSize;
    final private Callback nameCallback;
    
    public SingleLineContent(
            Orderer orderer,
            Callback nameCallback,
            int builderSize)
    {
        super(orderer);
        this.nameCallback = nameCallback;
        this.builderSize = builderSize;
    }
    
    @Override
    public String execute()
    {
        StringBuilder builder = new StringBuilder(builderSize);
        builder.append(nameCallback.call(null));
        String elements = orderer.childrenUnmodifiable().stream()
                .map(c -> c.toString())
                .collect(Collectors.joining(";"));
        if (! elements.isEmpty())
        {
            builder.append(";" + elements);
        }
        return builder.toString();
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy