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
|
* Validate all the parameters. Sub-classes may override this, but should
|
||||||
* call the super method in that case.
|
* call the super method in that case.
|
||||||
*/
|
*/
|
||||||
public void validate() {
|
@SuppressWarnings("unchecked")
|
||||||
|
public B validate() {
|
||||||
if (group == null) {
|
if (group == null) {
|
||||||
throw new IllegalStateException("group not set");
|
throw new IllegalStateException("group not set");
|
||||||
}
|
}
|
||||||
if (channelFactory == null) {
|
if (channelFactory == null) {
|
||||||
throw new IllegalStateException("factory not set");
|
throw new IllegalStateException("factory not set");
|
||||||
}
|
}
|
||||||
|
return (B) this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -188,11 +188,12 @@ public final class Bootstrap extends AbstractBootstrap<Bootstrap, Channel> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void validate() {
|
public Bootstrap validate() {
|
||||||
super.validate();
|
super.validate();
|
||||||
if (handler() == null) {
|
if (handler() == null) {
|
||||||
throw new IllegalStateException("handler not set");
|
throw new IllegalStateException("handler not set");
|
||||||
}
|
}
|
||||||
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -203,7 +203,7 @@ public final class ServerBootstrap extends AbstractBootstrap<ServerBootstrap, Se
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void validate() {
|
public ServerBootstrap validate() {
|
||||||
super.validate();
|
super.validate();
|
||||||
if (childHandler == null) {
|
if (childHandler == null) {
|
||||||
throw new IllegalStateException("childHandler not set");
|
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.");
|
logger.warn("childGroup is not set. Using parentGroup instead.");
|
||||||
childGroup = group();
|
childGroup = group();
|
||||||
}
|
}
|
||||||
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
|
Loading…
Reference in New Issue
Block a user