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

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

The newest version!
//
// Copyright 2015, 2016, 2019, 2021 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.lang.annotation.Documented;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

/**
 * This class-level annotation is required for all classes
 * extending {@link ERequestMessage}. This annotation contains
 * the {@link EReplyMessage} classes which may be sent in reply
 * to this request. The class {@code EReplyMessage} does not
 * need to be listed since it that message is allowed for all
 * request messages.
 * 

* This annotation is cumulative from {@link ERequestMessage} * down through extending request message classes. Since * {@code ERequestMessage} defines {@code EReplyInfo} to allow * {@code EReplyMessage} as a reply. This means * {@code EReplyMessage} may be sent in reply to any request. *

*

* As of eBus release 5.6.0 this annotation was modified to * contain two more attributes: {@code mayCancel} and * {@code cancelRequest}. These attributes are used to mark * whether a request may be unilaterally canceled by calling * {@code ERequestFeed.ERequest.close} and, if not, then * whether request may be canceled using a separate cancel * request message. The point behind using a cancel request * message is to allow the replier a chance to reject that cancel * request. *

* By default a request may be unilaterally {@code close}ed. * Otherwise there are two cases for using this annotation: *

*
    *
  1. * The request may not be canceled at all. In this case set * the annotation to {@code @EReplyInfo(mayClose = false)}. * Note that the {@code cancelRequest} is not set. *
  2. *
  3. * The request may be canceled using a separate message. Set * the annotation to * {@code @EReplyInfo(mayClose = false, cancelRequest = ECancelRequest.class)}. *
  4. *
*

* * @author Charles W. Rapp */ @Retention(RetentionPolicy.RUNTIME) @Target(ElementType.TYPE) @Documented public @interface EReplyInfo { /** * Returns the message classes which may be sent in reply * to a request message. * @return reply message classes. */ Class[] replyMessageClasses(); /** * Returns {@code true} if * {@code ERequestFeed.ERequest.inactivate()} may be used to * cancel {@link ERequestMessage}. Returns {@code false} if * {@code inactivate()} may not be used to cancel request. * {@code false} is generally returned if: *
    *
  • * the request processing cannot be stopped once started * or *
  • *
  • * replier requires a separate cancel request to * terminate an active request. This gives the replier * the option of denying the cancel request. This option * is not provided by {@code inactivate}. *
  • *
*

* Default value is {@code true} which means the request may * be directly closed. *

* @return {@code true} if request can be inactivated and * {@code false} if inactivation is not allowed. */ boolean mayClose() default true; } // end of annotation EReplyInfo




© 2015 - 2024 Weber Informatics LLC | Privacy Policy