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

org.mnode.ical4j.json.jscalendar.AbstractJSCalendarBuilder Maven / Gradle / Ivy

The newest version!
package org.mnode.ical4j.json.jscalendar;

import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.node.ObjectNode;
import org.mnode.ical4j.json.JsonBuilder;

public abstract class AbstractJSCalendarBuilder implements JsonBuilder {

    private final String objectType;

    protected T component;

    public AbstractJSCalendarBuilder(String objectType) {
        this.objectType = objectType;
    }

    public AbstractJSCalendarBuilder component(T component) {
        this.component = component;
        return this;
    }

    protected ObjectNode createObjectNode() {
        ObjectMapper mapper = new ObjectMapper();

        ObjectNode node = mapper.createObjectNode();
        node.put("@type", objectType);
        return node;
    }

    /**
     * Build a JSON node representing the JSCalendar object.
     * @return a JSON representation of a JSCalendar object
     */
    public abstract JsonNode build();
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy