net.sf.eBus.messages.ERequestMessage Maven / Gradle / Ivy
The newest version!
//
// Copyright 2013, 2015, 2016 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 application request messages.
* This class has no fields of its own. This class allows
* {@link EReplyMessage} to be used to reply to any and all
* request message classes.
*
* {@code ERequestMessage} subclasses must contain a class-level
* annotation {@link EReplyInfo}. This defines the reply message
* classes used to reply to the request message. This annotation
* is cumulative. The allowed reply messages include those listed
* in the current {@code EReplyInfo} annotation and those listed
* in the superclass {@code EReplyInfo} annotation. Since
* {@code EReplyMessage} is listed in the {@code ERequestMessage}
* {@code EReplyInfo} annotation, {@code EReplyMessage} is a
* valid reply to any request.
*
* {@literal @}EReplyInfo (replyMessageClasses = {OrderReply.class})
public final class OrderRequest
extends ERequestMessage
*
* @see ENotificationMessage
* @see EReplyMessage
* @see EReplyInfo
*
* @author Charles Rapp
*/
@EReplyInfo (replyMessageClasses = {EReplyMessage.class})
public abstract class ERequestMessage
extends EMessage
implements Serializable
{
//---------------------------------------------------------------
// Member data.
//
//-----------------------------------------------------------
// Constants.
//
/**
* Serialization version identifier.
*/
private static final long serialVersionUID = 0x060000L;
//---------------------------------------------------------------
// Member methods.
//
//-----------------------------------------------------------
// Constructors.
//
/**
* Creates a new eBus request 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 ERequestMessage(final Builder, ?> builder)
{
super (builder);
} // end of ERequestMessage(EMessageBuilder)
//
// end of Constructors.
//-----------------------------------------------------------
//---------------------------------------------------------------
// Inner classes.
//
/**
* Base class for request message builders.
* @param Target request message type.
* @param Target request message builder.
*/
@SuppressWarnings ("unchecked")
public abstract static class Builder>
extends EMessage.Builder
{
//-----------------------------------------------------------
// Member data.
//
//-----------------------------------------------------------
// Member methods.
//
//-------------------------------------------------------
// Constructors.
//
protected Builder(final Class extends EMessageObject> targetClass)
{
super (targetClass, MessageType.REQUEST);
} // end of Builder(Class)
//
// end of Constructors.
//-------------------------------------------------------
} // end of class Builder
} // end of class ERequestMessage