AbstractBootstrap.validate() should return reference to itself
This commit is contained in:
parent
fa1b49de98
commit
1033bec4cd
@ -199,13 +199,15 @@ abstract class AbstractBootstrap<B extends AbstractBootstrap<?, C>, C extends Ch
|
||||
* Validate all the parameters. Sub-classes may override this, but should
|
||||
* call the super method in that case.
|
||||
*/
|
||||
public void validate() {
|
||||
@SuppressWarnings("unchecked")
|
||||
public B validate() {
|
||||
if (group == null) {
|
||||
throw new IllegalStateException("group not set");
|
||||
}
|
||||
if (channelFactory == null) {
|
||||
throw new IllegalStateException("factory not set");
|
||||
}
|
||||
return (B) this;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -188,11 +188,12 @@ public final class Bootstrap extends AbstractBootstrap<Bootstrap, Channel> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void validate() {
|
||||
public Bootstrap validate() {
|
||||
super.validate();
|
||||
if (handler() == null) {
|
||||
throw new IllegalStateException("handler not set");
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -203,7 +203,7 @@ public final class ServerBootstrap extends AbstractBootstrap<ServerBootstrap, Se
|
||||
}
|
||||
|
||||
@Override
|
||||
public void validate() {
|
||||
public ServerBootstrap validate() {
|
||||
super.validate();
|
||||
if (childHandler == null) {
|
||||
throw new IllegalStateException("childHandler not set");
|
||||
@ -212,6 +212,7 @@ public final class ServerBootstrap extends AbstractBootstrap<ServerBootstrap, Se
|
||||
logger.warn("childGroup is not set. Using parentGroup instead.");
|
||||
childGroup = group();
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
|
Loading…
Reference in New Issue
Block a user