001/* 002 * Copyright 2002-2014 the original author or authors. 003 * 004 * Licensed under the Apache License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * 008 * https://www.apache.org/licenses/LICENSE-2.0 009 * 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013 * See the License for the specific language governing permissions and 014 * limitations under the License. 015 */ 016 017package org.springframework.messaging.support; 018 019import java.util.List; 020 021/** 022 * A {@link org.springframework.messaging.MessageChannel MessageChannel} that 023 * maintains a list {@link org.springframework.messaging.support.ChannelInterceptor 024 * ChannelInterceptors} and allows interception of message sending. 025 * 026 * @author Rossen Stoyanchev 027 * @since 4.1 028 */ 029public interface InterceptableChannel { 030 031 /** 032 * Set the list of channel interceptors clearing any existing interceptors. 033 */ 034 void setInterceptors(List<ChannelInterceptor> interceptors); 035 036 /** 037 * Add a channel interceptor to the end of the list. 038 */ 039 void addInterceptor(ChannelInterceptor interceptor); 040 041 /** 042 * Add a channel interceptor at the specified index. 043 */ 044 void addInterceptor(int index, ChannelInterceptor interceptor); 045 046 /** 047 * Return the list of configured interceptors. 048 */ 049 List<ChannelInterceptor> getInterceptors(); 050 051 /** 052 * Remove the given interceptor. 053 */ 054 boolean removeInterceptor(ChannelInterceptor interceptor); 055 056 /** 057 * Remove the interceptor at the given index. 058 */ 059 ChannelInterceptor removeInterceptor(int index); 060 061}