开发者

How to name the import / export packages in Java?

开发者 https://www.devze.com 2023-02-14 18:28 出处:网络
I have an export / import routine which becomes bigger and I decided to split up the packages into two smaller.

I have an export / import routine which becomes bigger and I decided to split up the packages into two smaller.

I tried to use org.yourcompany.business.export ...works fine! Unfortunately the opposite package with the name org.yourcompany.business.import is not possible to use 开发者_StackOverflow中文版due to the reserved keyword import in Java.

How do you name your import / export packages?

Thank you!


We're using exporter/importer.

Or maybe you want to use something like exchange.in and exchange.out, since that's normally the purpose of an importer/exporter - to exchange data.


Write separate importer/exporter for this

Hope this will help!


I would probably go with importpkg / exportpkg or businessimport / businessexport just to stick to the name "import", if that is the word best describing the content of the package. An alternative would be to follow the naming convention for really long identifiers, and drop a vowel in end: imprt.


I usually use lib or api or util for libraries. Something which indicates what is being imported

Packages are designed for importing so the word in a package is somewhat redundant.


I'd recommend exp0rt imp0rt in order to look like java renames (class into clazz)


An option is to use the abbreviation of the words. This would be something like imp and exp. Or if you have given the imp/exp functionality a name, you could use that as the package name, like if.myinterfacename.


Yes, import is a keyword in java, you will have to think of another name for your package.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号