什么是java域模型? [英] What is java domain model?
问题描述
我正在学习一本Spring书,他们提到了java域模型。
这是什么?
I am studying a Spring book and they mention java domain model. What is that?
推荐答案
域模型(该术语根本不是特定于Java的)是一个类模拟问题域中的某些东西,而不是出于技术实现原因而存在的类。
A domain model (the term is not at all Java specific) is a class that models something in the problem domain, as opposed to a class that exists for technical implementation reasons.
域模型实例通常需要保存在数据库中,并且在Java中,它们通常符合Java Beans规范,即它们具有表示单个属性和无参数构造函数的get和set方法。 Spring和其他框架允许您直接在JSP中访问这些属性。
Domain model instances often need to be persisted in a database, and in Java, they typically conform to the Java Beans specification, i.e. they have get and set methods to represent individual properties and a parameterless constructor. Spring and other frameworks allow you to access these properties directly in your JSPs.
例如,在商店应用程序中,您的一些域模型类将是Product,Order, ShoppingCart和Customer。
For example, in a shop application, some of your domain model classes would be Product, Order, ShoppingCart and Customer.
这篇关于什么是java域模型?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!