Sub Class Handler provides you the facility to add different child classes of single resource while handling all the complex work behind. You only need to provide annotation @SubClassHandler. For example, Order class has two child classes DrugOrder and TestOrder, but there is only one single @Resource class of OrderResource. The child classes have their @subclasshandler classes instead of separate resource.
In Order model, Rest Module has only used single @Resource for parent only. The child classes have only
/**
- Resource for
Unknown macro: {@link Order}and all of its subclasses
*/
@Resource(name = RestConstants.VERSION_1 + "/order", supportedClass = Order.class, supportedOpenmrsVersions =Unknown macro: { "1.8.*", "1.9.*" }, order = 1)
public class OrderResource1_8 extends DataDelegatingCrudResource<Order> {
}
The Child classes of Order have annotated @SubClassHandler , extends BaseDelegatingSubclassHandler<parent, child> and implements DelegatingSubclassHandler<parent,child> .
@SubClassHandler(supportedClass = DrugOrder.class, supportedOpenmrsVersions =
)
public class DrugOrderSubclassHandler1_8 extends BaseDelegatingSubclassHandler<Order, DrugOrder> implements DelegatingSubclassHandler<Order, DrugOrder> {
public DrugOrderSubclassHandler1_8()
}
This has resolved all the type and heritage issues and rest module take controls of all the rest.