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

com.getsentry.raven.event.BreadcrumbBuilder Maven / Gradle / Ivy

There is a newer version: 8.0.3
Show newest version
package com.getsentry.raven.event;

import java.util.Date;
import java.util.Map;

/**
 * Builder to assist the creation of {@link Breadcrumb}s.
 */
public class BreadcrumbBuilder {

    private String type;
    private Date timestamp;
    private String level;
    private String message;
    private String category;
    private Map data;

    /**
     * Type of the {@link Breadcrumb}.
     *
     * @param newType String
     * @return current BreadcrumbBuilder
     */
    public BreadcrumbBuilder setType(String newType) {
        this.type = newType;
        return this;
    }

    /**
     * Timestamp of the {@link Breadcrumb}.
     *
     * @param newTimestamp Date
     * @return current BreadcrumbBuilder
     */
    public BreadcrumbBuilder setTimestamp(Date newTimestamp) {
        this.timestamp = newTimestamp;
        return this;
    }

    /**
     * Level of the {@link Breadcrumb}.
     *
     * @param newLevel String
     * @return current BreadcrumbBuilder
     */
    public BreadcrumbBuilder setLevel(String newLevel) {
        this.level = newLevel;
        return this;
    }

    /**
     * Message of the {@link Breadcrumb}. At least one of message or
     * data is required.
     *
     * @param newMessage String
     * @return current BreadcrumbBuilder
     */
    public BreadcrumbBuilder setMessage(String newMessage) {
        this.message = newMessage;
        return this;
    }

    /**
     * Category of the {@link Breadcrumb}.
     *
     * @param newCategory String
     * @return current BreadcrumbBuilder
     */
    public BreadcrumbBuilder setCategory(String newCategory) {
        this.category = newCategory;
        return this;
    }

    /**
     * Data related to the {@link Breadcrumb}. At least one of message or
     * data is required.
     *
     * @param newData Map of String to String
     * @return current BreadcrumbBuilder
     */
    public BreadcrumbBuilder setData(Map newData) {
        this.data = newData;
        return this;
    }

    /**
     * Build and return the {@link Breadcrumb} object.
     *
     * @return Breadcrumb
     */
    public Breadcrumb build() {
        return new Breadcrumb(type, timestamp, level, message, category, data);
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy