concept domain object in category spring

appears as: domain objects, domain object, The domain objects
Spring in Practice

This is an excerpt from Manning's book Spring in Practice.

Model-view-controller (MVC) refers to the architectural pattern in which you separate your business services and domain objects (the model) from the UI (the view) and mediate their interaction through one or more controllers. You’d like to be able to modify your UI without having to change your business logic and domain objects, and separating the model and view makes it easier to do just that. It’s a simple but proven concept.

Another approach is to implement your form bean separately from your domain model. This can make sense when the domain model has properties for which there aren’t corresponding form fields, when the form has fields for which there aren’t corresponding domain object properties, or both. A good example (which you’ll see in chapter 4, even though there you use the domain object as a form bean after all) is a user registration form. Most registration forms have a “confirm password” field, and many have CAPTCHA fields, but neither of those is properly part of the domain model. Similarly, the domain model often has properties such as confirmed, enabled, and so forth. Obviously you wouldn’t include those as form fields.

Figure 7.9. How Spring Security ties its ACL schema to domain objects
Spring Integration in Action

This is an excerpt from Manning's book Spring Integration in Action.

Figure 5.2. A transformer that unmarshals a flight from XML to a domain object

Let’s begin with a simple but common case. Objects from a domain model are often represented to the outside world by the simplest means possible. Typically that means the external representation includes the least amount of data sufficient to uniquely identify the object. For example, consider a domain object that maps to a flight. The flight can be uniquely identified by the flight number and its date. That content is simple enough to be represented in text or in a more structured form, such as comma-separated value (CSV) or XML. Figure 5.1 depicts schematically how different transformations can morph the Flight domain object into different interoperable formats.

Listing 16.3. A FieldSetMapper converts raw input into a domain object
public class PaymentFieldSetMapper implements FieldSetMapper<Payment> { @Override public Payment mapFieldSet(FieldSet fieldSet) throws BindException { Payment payment = new Payment(); payment.setSourceAccountNo(fieldSet.readString("source")); payment.setDestinationAccountNo( fieldSet.readString("destination")); payment.setAmount(fieldSet.readBigDecimal("amount")); payment.setDate(fieldSet.readDate("date")); return payment; } }