简体   繁体   English

根据 class 使用分配正确的 package

[英]Asigning Correct package as per class uses

I have a java web service application, having two packages.我有一个 java web 服务应用程序,有两个包。

com.demo.webappl.dao <= contains the Data Access Object classes. com.demo.webappl.dao <= 包含数据访问 Object 类。

com.demo.webappl.dto <= contains the data transfer Object Classes. com.demo.webappl.dto <= 包含数据传输 Object 类。

But there are some other POJO classes which are used in commonly in these dto and dao classes, logically what should I name that pages which contains POJO classes which are neither dao nor dto .但是在这些dtodao类中通常使用其他一些 POJO 类,从逻辑上讲,我应该为那些包含既不是dao也不是dto的 POJO 类的页面命名。

Usually, objects that you use to share data across different layers of your program classify under dto .通常,用于在程序的不同层之间共享数据的对象归类在dto下。 These classes sometimes are left in the "root" package ( com.demo.webappl ).这些类有时会留在“根” package ( com.demo.webappl ) 中。 For objects with are used internally in a single package can be left in the package itself ( com.demo.webappl.module1 ).对于在单个 package 内部使用的对象,可以将其留在 package 本身( com.demo.webappl.module1 )。

For better clarity, try checking your organization or the framework's coding standards/guidelines.为了更清楚,请尝试检查您的组织或框架的编码标准/指南。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM