打破一个大的Java枚举 [英] Breaking up a large Java enum

查看:115
本文介绍了打破一个大的Java枚举的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用已经说出1300个值并将其放入有组织的组中的Java枚举是什么推荐的做法?我知道你不能扩展枚举组,所以还有其他很好的选择?

What is the recommended practice for taking a Java enum that has say 1300 values and putting it into organized groups? I know you can't just extends the enum group, so are there other good alternatives?

推荐答案

我将使用一个接口这些实例都共享,那么您可以使用任意数量的枚举,或从其他数据源(如文件或数据库)加载它们。

I would use an interface which these instances all share, then you can use any number of enums or load them from another data source such as a file or database.

这篇关于打破一个大的Java枚举的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆