RoutingService

Provides the ability to return (and therefore have rendered) an alternative object from an action invocation.

Primary use case: if an action returns an aggregate leaf (that is, a child object which has an owning parent), then the parent object can be returned instead.

For example, an action returning OrderItem might instead render the owning Order object. It is the responsibility of the implementation to figure out what the "owning" object might be.

Currently this service is used only by the Wicket viewer; it is ignored by the Restful Objects viewer.

API

RoutingService.java
interface RoutingService {
  boolean canRoute(@NonNull Object original) (1)
  Object route(@NonNull Object original)     (2)
}
1 canRoute(@NonNull Object)

whether this implementation recognizes and can "route" the object.

2 route(@NonNull Object)

The object to route to instead; this may be the same as the original object, some other object, or (indeed) null.

Members

canRoute(@NonNull Object)

whether this implementation recognizes and can "route" the object.

The #route(Object) method is only called if this method returns true .

route(@NonNull Object)

The object to route to instead; this may be the same as the original object, some other object, or (indeed) null.