/* * Copyright 2011 The Netty Project * * The Netty Project licenses this file to you 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 io.netty.channel; import io.netty.channel.socket.SocketChannelConfig; import io.netty.channel.socket.nio.NioSocketChannelConfig; import java.util.Map; /** * A set of configuration properties of a {@link Channel}. *
* Please down-cast to more specific configuration type such as * {@link SocketChannelConfig} or use {@link #setOptions(Map)} to set the * transport-specific properties: *
* {@link Channel} ch = ...; * {@link SocketChannelConfig} cfg = ({@link SocketChannelConfig}) ch.getConfig(); * cfg.setTcpNoDelay(false); ** *
* Options are available in the sub-types of {@link ChannelConfig}. For
* example, you can configure the parameters which are specific to a TCP/IP
* socket as explained in {@link SocketChannelConfig} or {@link NioSocketChannelConfig}.
*
* @apiviz.has io.netty.channel.ChannelPipelineFactory
* @apiviz.composedOf io.netty.channel.ReceiveBufferSizePredictor
*
* @apiviz.excludeSubtypes
*/
public interface ChannelConfig {
/**
* Sets the configuration properties from the specified {@link Map}.
*/
void setOptions(Map
* public boolean setOption(String name, Object value) {
* if (super.setOption(name, value)) {
* return true;
* }
*
* if (name.equals("additionalOption")) {
* ....
* return true;
* }
*
* return false;
* }
*
*
* @return {@code true} if and only if the property has been set
*/
boolean setOption(String name, Object value);
}