net.sf.eBus.messages.ESystemMessage Maven / Gradle / Ivy
The newest version!
//
// Copyright 2013, 2016, 2019 Charles W. Rapp
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
package net.sf.eBus.messages;
import java.io.Serializable;
/**
* Required base class for all system messages. Note that system
* messages may not be used by applications. If an eBus
* application extends this class, it will not be able to send
* or received such a message. System messages are meant for
* internal eBus use only.
*
* @author Charles Rapp
*/
public abstract class ESystemMessage
extends EMessage
implements Serializable
{
//---------------------------------------------------------------
// Member data.
//
//-----------------------------------------------------------
// Constants.
//
/**
* All system messages use the same subject: "/eBus".
*/
public static final String SYSTEM_SUBJECT = "/eBus";
/**
* Serialization version identifier.
*/
private static final long serialVersionUID = 0x050200L;
//---------------------------------------------------------------
// Member methods.
//
//-----------------------------------------------------------
// Constructors.
//
/**
* Creates a new system message based on the given message
* builder. {@code builder} is guaranteed to contain a valid
* message configuration at this point.
* @param builder contains the eBus message configuration.
*/
protected ESystemMessage(final Builder, ?> builder)
{
super (builder);
} // end of ESystemMessage(EMessageBuilder)
//
// end of Constructors.
//-----------------------------------------------------------
//---------------------------------------------------------------
// Inner classes.
//
/**
* Base class for all {@link ESystemMessage} builders. Used
* by eBus when de-serializing an encoded message back into
* the target message object.
*
* @param target message class.
* @param concrete (leaf) builder subclass.
*/
@SuppressWarnings ("unchecked")
public abstract static class Builder>
extends EMessage.Builder
{
//-----------------------------------------------------------
// Member data.
//
//-----------------------------------------------------------
// Member methods.
//
//-------------------------------------------------------
// Constructors.
//
protected Builder(final Class extends EMessageObject> targetClass)
{
super (targetClass,
SYSTEM_SUBJECT,
System.currentTimeMillis(),
MessageType.SYSTEM);
} // end of Builder(Class)
//
// end of Constructors.
//-------------------------------------------------------
} // end of class Builder
} // end of class ESystemMessage