001package jmri;
002
003import javax.annotation.Nonnull;
004
005/**
006 * This is a data structure to pass usage information from getUsageReport() requests
007 * back to the calling object.
008 *
009 * @author Dave Sand Copyright (C) 2020
010 */
011@javax.annotation.concurrent.Immutable
012public class NamedBeanUsageReport {
013
014    final public String usageKey;
015    final public NamedBean usageBean;
016    final public String usageData;
017
018    /**
019     * Create report with the required key.
020     * @param usageKey Identifies the report type.  Used to control result.
021     */
022    public NamedBeanUsageReport(@Nonnull String usageKey) {
023        this(usageKey, null, "");
024    }
025
026    /**
027     * Create report with the required key and a bean.
028     * @param usageKey Identifies the report type.  Used to control result.
029     * @param usageBean Identifies a related bean such as SML destination mast.  Can be null.
030     */
031    public NamedBeanUsageReport(@Nonnull String usageKey, NamedBean usageBean) {
032        this(usageKey, usageBean, "");
033    }
034
035    /**
036     * Create report with the required key and additional data.
037     * @param usageKey Identifies the report type.  Used to control result.
038     * @param usageData Optional additional data.
039     */
040    public NamedBeanUsageReport(@Nonnull String usageKey, String usageData) {
041        this(usageKey, null, usageData);
042    }
043
044    /**
045     * Create a usage report.
046     *
047     * @param usageKey Identifies the report type.  Used to control result
048     * processing.  Might also be used as a bundle key.
049     * @param usageBean Identifies a related bean such as SML destination mast.  Can be null.
050     * @param usageData Optional additional data.
051     */
052    public NamedBeanUsageReport(@Nonnull String usageKey, NamedBean usageBean, String usageData) {
053        this.usageKey = usageKey;
054        this.usageBean = usageBean;
055        this.usageData = usageData;
056    }
057}