Design Pattern Transfer Object Pattern - Design Patterns

What is Design Pattern Transfer Object Pattern?

The Transfer Object pattern is use when we want to exceed data with many attributes in one attempt from client to server. Transfer object is also recognized as Value Object. Transfer Object is a simple POJO class having getter/setter methods and is serializable so that it can be transferred over the network. It does not have any behaviour. Server Side business class usually fetches data from the database and fills the POJO and send it to the client or pass it by value. For client, transfer object is read-only. User can create its own transfer object and pass it to server to update values in database in one attempt. Following are the entities of this kind of design pattern.

  • Business Object - Business Service fills the Transfer Object with data.
  • Transfer Object - Simple POJO having methods to set/get attributes only.
  • Client - Client either requests or sends the Transfer Object to Business Object.

Implementation

We are obtainable to make a Student BO as Business Object, Student as Transfer Object expressive our entities.

TransferObjectPatternDemo, our demo class, is stand-in as a user here and will use Student BO and Student to express Transfer Object Design Pattern.
transferobject_pattern_uml_diagram

Step 1

Create Transfer Object.

StudentVO.java

Step 2

Build Business Object.

StudentBO.java

Step 3

Use the Student BO to demonstrate Transfer Object Design Pattern.

TransferObjectPatternDemo.java

Step 4

Verify the output.

All rights reserved © 2018 Wisdom IT Services India Pvt. Ltd DMCA.com Protection Status

Design Patterns Topics