You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@shenyu.apache.org by Zhenbing Feng <fe...@apache.org> on 2021/05/25 16:13:26 UTC

Should we optimize the code to avoid using magic number .Or Are there other considerations.

 When I configure `shenyu.httpclient.strategy=netty ` to use
 NettyClientResponsePlugin.


I have found some magic number here in NettyClientResponsePlugin

@Override
public int getOrder() {
    return 100;
}

@Override
public String named() {
    return "NettyClientResponse";
}


 Should we optimize the code to avoid using magic number like this

@Override
public int getOrder() {
    return PluginEnum.RESPONSE.getCode();
}

@Override
public String named() {
    return PluginEnum.RESPONSE.getName();
}

Re: Should we optimize the code to avoid using magic number .Or Are there other considerations.

Posted by XiaoYu <xi...@apache.org>.
Maybe there are others, maybe it's my mistake before, please fix it

Zhenbing Feng <fe...@apache.org> 于2021年5月26日周三 上午10:01写道:

> OK,It's a minor modification. I will deal with it.
>
> Liming Deng <de...@apache.org> 于2021年5月26日周三 上午9:24写道:
>
> > Feel free to optimize it.
> >
> > Zhenbing Feng <fe...@apache.org> 于2021年5月26日周三 上午12:13写道:
> >
> > >  When I configure `shenyu.httpclient.strategy=netty ` to use
> > >  NettyClientResponsePlugin.
> > >
> > >
> > > I have found some magic number here in NettyClientResponsePlugin
> > >
> > > @Override
> > > public int getOrder() {
> > >     return 100;
> > > }
> > >
> > > @Override
> > > public String named() {
> > >     return "NettyClientResponse";
> > > }
> > >
> > >
> > >  Should we optimize the code to avoid using magic number like this
> > >
> > > @Override
> > > public int getOrder() {
> > >     return PluginEnum.RESPONSE.getCode();
> > > }
> > >
> > > @Override
> > > public String named() {
> > >     return PluginEnum.RESPONSE.getName();
> > > }
> > >
> >
>

Re: Should we optimize the code to avoid using magic number .Or Are there other considerations.

Posted by Zhenbing Feng <fe...@apache.org>.
OK,It's a minor modification. I will deal with it.

Liming Deng <de...@apache.org> 于2021年5月26日周三 上午9:24写道:

> Feel free to optimize it.
>
> Zhenbing Feng <fe...@apache.org> 于2021年5月26日周三 上午12:13写道:
>
> >  When I configure `shenyu.httpclient.strategy=netty ` to use
> >  NettyClientResponsePlugin.
> >
> >
> > I have found some magic number here in NettyClientResponsePlugin
> >
> > @Override
> > public int getOrder() {
> >     return 100;
> > }
> >
> > @Override
> > public String named() {
> >     return "NettyClientResponse";
> > }
> >
> >
> >  Should we optimize the code to avoid using magic number like this
> >
> > @Override
> > public int getOrder() {
> >     return PluginEnum.RESPONSE.getCode();
> > }
> >
> > @Override
> > public String named() {
> >     return PluginEnum.RESPONSE.getName();
> > }
> >
>

Re: Should we optimize the code to avoid using magic number .Or Are there other considerations.

Posted by Liming Deng <de...@apache.org>.
Feel free to optimize it.

Zhenbing Feng <fe...@apache.org> 于2021年5月26日周三 上午12:13写道:

>  When I configure `shenyu.httpclient.strategy=netty ` to use
>  NettyClientResponsePlugin.
>
>
> I have found some magic number here in NettyClientResponsePlugin
>
> @Override
> public int getOrder() {
>     return 100;
> }
>
> @Override
> public String named() {
>     return "NettyClientResponse";
> }
>
>
>  Should we optimize the code to avoid using magic number like this
>
> @Override
> public int getOrder() {
>     return PluginEnum.RESPONSE.getCode();
> }
>
> @Override
> public String named() {
>     return PluginEnum.RESPONSE.getName();
> }
>