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

net.sf.eBus.messages.ENotificationMessage Maven / Gradle / Ivy

//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any later
// version.
//
// This library is distributed in the hope that it will be
// useful, but WITHOUT ANY WARRANTY; without even the implied
// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
// PURPOSE. See the GNU Lesser General Public License for more
// details.
//
// You should have received a copy of the GNU Lesser General
// Public License along with this library; if not, write to the
//
// Free Software Foundation, Inc.,
// 59 Temple Place, Suite 330,
// Boston, MA
// 02111-1307 USA
//
// The Initial Developer of the Original Code is Charles W. Rapp.
// Portions created by Charles W. Rapp are
// Copyright 2013, 2016. Charles W. Rapp
// All Rights Reserved.
//

package net.sf.eBus.messages;

import java.io.Serializable;

/**
 * Required base class for all application publish/subscribe
 * notification messages. This class has no fields of its own.
 *
 * @see ERequestMessage
 * @see EReplyMessage
 *
 * @author Charles Rapp
 */

@EFieldInfo (fields = {})
public abstract class ENotificationMessage
    extends EMessage
    implements Serializable
{
//---------------------------------------------------------------
// Member data.
//

    //-----------------------------------------------------------
    // Constants.
    //

    /**
     * Serialization version identifier.
     */
    private static final long serialVersionUID = 0x060100L;

//---------------------------------------------------------------
// Member methods.
//

    //-----------------------------------------------------------
    // Constructors.
    //

    /**
     * Creates an eBus notification message with the given
     * subject. The message timestamp is set to the current time.
     * @param subject the notification subject.
     * @throws IllegalArgumentException
     * if {@code subject} is either {@code null} or empty.
     */
    protected ENotificationMessage(final String subject)
        throws IllegalArgumentException
    {
        super (subject,
               System.currentTimeMillis(),
               MessageType.NOTIFICATION);
    } // end of ENotificationMessage(String)

    /**
     * Creates a new notification message instance for the given
     * subject and timestamp. This constructor is used for
     * message de-serialization.
     * 

* This constructor is {@code public} due to automatic * message compilation and generic message field * requirements. *

* @param subject the message subject. * @param timestamp the message timestamp (Java millisecond * epoch time). * @throws IllegalArgumentException * if {@code subject} is either of {@code null} or empty. */ public ENotificationMessage(final String subject, final long timestamp) throws IllegalArgumentException { super (subject, timestamp, MessageType.NOTIFICATION); } // end of ENotificationMessage(String, long) // // end of Constructors. //----------------------------------------------------------- } // end of class ENotificationMessage




© 2015 - 2025 Weber Informatics LLC | Privacy Policy