Skip to content
Model centric tools for Spring development Community portal
Skyway PerspectivesModel driven delivery

MyEclipse for Spring

Code Reference: GwtCustomerServiceImpl.java, Alternate Variant

The second generated variant of the remote service, using a different mapping style and a narrower result type.

Code assistant view showing generated Java types and model annotations
Figure 30. The alternate variant maps fields directly and returns a narrow result.

The sample project includes a second variant of the remote service. It exists to show that the generator can produce more than one mapping style from the same model. The variant maps fields directly instead of using a converter, and it returns a narrow result type for list screens.

Differences from the first variant

  • Mapping. Field by field assignment inside each method.
  • Result. A narrow summary type for list screens.
  • Queries. A single list query with a projection.
  • Errors. A short message rather than a detailed remote exception.

When to use it

Use the narrow variant when the client list screen needs only a few columns. A smaller payload makes the screen faster and reduces the chance that a sensitive field reaches the browser. Use the full variant when the client edits the whole record.

Pick one per screen. Do not mix both variants on the same screen. Two mapping styles in one place make the data flow hard to follow.

Both variants call the same service layer, so the business rules are identical. That is the value of keeping the bridge thin: the mapping style can change without changing the rules.