English 中文(简体)
一揽子名称的 Java代码公约[复制]
原标题:Java code convention for package names [duplicate]
This question already has answers here:
Closed 11 years ago.

Possible Duplicate:
what is the convention for word separator in java package names?

我很想知道,是否有一部包含几个字的包裹编码。 例如,包装名称com.dreamcom.objectInterfaces。 这起案件是否适合?

最佳回答

http://en.wikipedia.org/wiki/Java_ Package#Package_naming_conventions”rel=“nofollow noreferer” @ Wikipedia(着重部分由作者标明):

Packages are usually defined using a hierarchical naming pattern, with levels in the hierarchy separated by periods (.) (pronounced "dot"). Although packages lower in the naming hierarchy are often referred to as "subpackages" of the corresponding packages higher in the hierarchy, there is almost no semantic relationship between packages. The Java Language Specification establishes package naming conventions to avoid the possibility of two published packages having the same name. The naming conventions describe how to create unique package names, so that packages that are widely distributed will have unique namespaces. This allows packages to be separately, easily and automatically installed and catalogued.

In general, a package name begins with the top level domain name of the organization and then the organization s domain and then any subdomains, listed in reverse order. The organization can then choose a specific name for its package. Package names should be all lowercase characters whenever possible.

For example, if an organization in Canada called MySoft creates a package to deal with fractions, naming the package ca.mysoft.fractions distinguishes the fractions package from another similar package created by another company. If a German company named MySoft also creates a fractions package, but names it de.mysoft.fractions, then the classes in these two packages are defined in a unique and separate namespace.

Complete conventions for disambiguating package names and rules for naming packages when the Internet domain name cannot be directly used as a package name are described in section 7.7 of the Java Language Specification.


See also:

问题回答

公约将在整个过程中使用较少的情况。

详情见JLS

卡梅尔-加固式包裹的名字与我一样。 我以一揽子的名义说几句:

  1. Isn t "com.dreamcom.interfaces" good enough?

  2. “com.dreamcom.object.interfaces”工作吗?

如果不是的话,而是将“com.dreamcom.objectinterfaces”视为 came。

之所以如此,是因为一揽子名称反映了东道非洲办事处的名录。 关于六氯环己烷“com.dreamcom.object Interfaces”和“com.dreamcom.objectinterfaces”是不同的,而在Windows上也是一样的。





相关问题
Spring Properties File

Hi have this j2ee web application developed using spring framework. I have a problem with rendering mnessages in nihongo characters from the properties file. I tried converting the file to ascii using ...

Logging a global ID in multiple components

I have a system which contains multiple applications connected together using JMS and Spring Integration. Messages get sent along a chain of applications. [App A] -> [App B] -> [App C] We set a ...

Java Library Size

If I m given two Java Libraries in Jar format, 1 having no bells and whistles, and the other having lots of them that will mostly go unused.... my question is: How will the larger, mostly unused ...

How to get the Array Class for a given Class in Java?

I have a Class variable that holds a certain type and I need to get a variable that holds the corresponding array class. The best I could come up with is this: Class arrayOfFooClass = java.lang....

SQLite , Derby vs file system

I m working on a Java desktop application that reads and writes from/to different files. I think a better solution would be to replace the file system by a SQLite database. How hard is it to migrate ...

热门标签