Skip to content
New issue

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

Client 和 基础层都用到的枚举类应该放哪里? #435

Open
lvxi0605 opened this issue Jun 20, 2023 · 5 comments
Open

Client 和 基础层都用到的枚举类应该放哪里? #435

lvxi0605 opened this issue Jun 20, 2023 · 5 comments

Comments

@lvxi0605
Copy link

No description provided.

@lmlx66
Copy link

lmlx66 commented Jun 26, 2023

我个人觉得都放。

@harborlee
Copy link

个人觉得,枚举不应该对外,client层和基础层不应使用枚举。枚举应该放在domain层,app层可以通过依赖domain层来使用该枚举。

@lvxi0605
Copy link
Author

个人觉得,枚举不应该对外,client层和基础层不应使用枚举。枚举应该放在domain层,app层可以通过依赖domain层来使用该枚举。

dubbo调用时也不建议用枚举作为参数传递,但是之前做的项目就是每层都要转换,request对象转domain对象,domain对象转po,枚举都要转成String或者Integer, String或者Integer 转换成 枚举 ,还是挺麻烦的

@allenbin
Copy link

allenbin commented Aug 4, 2023

枚举一般我们有两个主要用途,业务的辅助逻辑判断和渲染数据时文本转换等,所以domain和app层都会用到,我觉得放在基础实施层的common包中

@yicone
Copy link

yicone commented Sep 11, 2023

domain层需要的枚举,放在domain层,因为domain层不应依赖于infra层;除此之外的、其它层需要的枚举,放在infra层。
就好像各层都有class一样,认为枚举“放在一起好管理”的这种思路是不合适的。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants