* Made ChannelConfig.setOption() public

This commit is contained in:
Trustin Lee 2009-02-25 14:53:31 +00:00
parent 988fff225f
commit 13c68c7643
7 changed files with 28 additions and 10 deletions

View File

@ -78,6 +78,28 @@ public interface ChannelConfig {
*/
void setOptions(Map<String, Object> options);
/**
* Sets a configuration property with the specified name and value.
* To override this method properly, you must call the super class:
* <pre>
* public boolean setOption(String name, Object value) {
* if (super.setOption(name, value)) {
* return true;
* }
*
* if (name.equals("additionalOption")) {
* ....
* return true;
* }
*
* return false;
* }
* </pre>
*
* @return {@code true} if and only if the property has been set
*/
boolean setOption(String name, Object value);
ChannelBufferFactory getBufferFactory();
void setBufferFactory(ChannelBufferFactory bufferFactory);

View File

@ -56,11 +56,7 @@ public class DefaultChannelConfig implements ChannelConfig {
}
}
/**
* Sets an individual option. You can override this method to support
* additional configuration parameters.
*/
protected boolean setOption(String key, Object value) {
public boolean setOption(String key, Object value) {
if (key.equals("pipelineFactory")) {
setPipelineFactory((ChannelPipelineFactory) value);
} else if (key.equals("bufferFactory")) {

View File

@ -59,7 +59,7 @@ public class DefaultServerChannelConfig implements ChannelConfig {
* Sets an individual option. You can override this method to support
* additional configuration parameters.
*/
protected boolean setOption(String key, Object value) {
public boolean setOption(String key, Object value) {
if (key.equals("pipelineFactory")) {
setPipelineFactory((ChannelPipelineFactory) value);
} else if (key.equals("bufferFactory")) {

View File

@ -54,7 +54,7 @@ public class DefaultServerSocketChannelConfig extends DefaultServerChannelConfig
}
@Override
protected boolean setOption(String key, Object value) {
public boolean setOption(String key, Object value) {
if (super.setOption(key, value)) {
return true;
}

View File

@ -54,7 +54,7 @@ public class DefaultSocketChannelConfig extends DefaultChannelConfig
}
@Override
protected boolean setOption(String key, Object value) {
public boolean setOption(String key, Object value) {
if (super.setOption(key, value)) {
return true;
}

View File

@ -58,7 +58,7 @@ final class HttpTunnelingSocketChannelConfig extends DefaultChannelConfig
}
@Override
protected boolean setOption(String key, Object value) {
public boolean setOption(String key, Object value) {
if (key.equals("receiveBufferSize")) {
setReceiveBufferSize(ConversionUtil.toInt(value));
} else if (key.equals("sendBufferSize")) {

View File

@ -72,7 +72,7 @@ class DefaultNioSocketChannelConfig extends DefaultSocketChannelConfig
}
@Override
protected boolean setOption(String key, Object value) {
public boolean setOption(String key, Object value) {
if (super.setOption(key, value)) {
return true;
}