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

net.sf.eBus.client.ECondition Maven / Gradle / Ivy

The newest version!
//
// Copyright 2009, 2011, 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.client;

import net.sf.eBus.messages.EMessage;

/**
 * This interface allows {@link ESubscribeFeed} and
 * {@link EReplyFeed} to automatically test a message in order
 * to determine if it should be passed on to a client. If
 * {@link ECondition#test(EMessage) test} returns {@code true}
 * eBus forwards the message to the client. If {@code test}
 * returns {@code false} or throws an exception, then the message
 * is not forwarded.
 * 

* In eBus v. 4.2.0, this interface is now marked as a * {@code @FunctionalInterface}, allowing this interface to be * defined using a Java lambda expression. *

* * @author Charles Rapp */ @FunctionalInterface public interface ECondition { //-------------------------------------------------------------- // Member methods. // /** * Returns {@code true} if the message meets this condition * and so should be passed to the eBus client; {@code false} * if the message should not be passed on. If this method * throws an exception, it is treated the same as having * returned {@code false}. * @param msg The tested notification message. * @return {@code true} if the message meets this condition * and so should be passed to the eBus client. */ boolean test(EMessage msg); } // end of interface ECondition




© 2015 - 2024 Weber Informatics LLC | Privacy Policy