We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
easy api config:
enum.use.custom[groovy:it.isExtend("com.zbycorp.fenghuo.domain.common.constants.BaseEnum")]=code
基类
public interface BaseEnum { default String enumClass() { return this.getClass().getName(); } /** * 枚举一般作为value的字段 */ Object getCode(); }
实现类
@Getter public enum StrategyTypeEnum implements BaseEnum { CAMPAIGN_BUDGET("广告活动分时预算"), TARGET_BID("分时竞价") ; private String desc; StrategyTypeEnum(String desc) { this.desc = desc; } @Override public String getCode() { return this.name(); } }
使用地方
/** * @see StrategyTypeEnum */ @ApiModelProperty("策略类型") private String strategyType;
结果 没有输出任何值, 去掉配置之后 就可以输出了, 不知道为啥, 也没报错
The text was updated successfully, but these errors were encountered:
😂,目前还没有办法解析方法, 虽然你这里的例子并不复杂。
@Override public String getCode() { return this.name(); }
但如果你这里getCode返回的总是name(),那可以试试直接配:
getCode
name()
enum.use.custom[groovy:it.isExtend("com.zbycorp.fenghuo.domain.common.constants.BaseEnum")]=name()
Sorry, something went wrong.
只是部分枚举用到了name() , 还是希望能支持下方法撒 😄
有尝试过实现方法推断,但是代码逻辑太复杂了可能导致卡死,目前还没有找到好的实现方案。 https://github.com/tangcent/easy-yapi/blob/master/idea-plugin/src/main/kotlin/com/itangcent/idea/plugin/api/DefaultMethodInferHelper.kt
只是部分枚举用到了name()
其他的大概是怎么样的?
就是部分枚举 没有写任何属性, 直接继承了 BaseEnum , 重写了 getCode 直接用的 name() (⊙o⊙)…
No branches or pull requests
easy api config:
基类
实现类
使用地方
结果
没有输出任何值, 去掉配置之后 就可以输出了, 不知道为啥, 也没报错
The text was updated successfully, but these errors were encountered: