Type: New Feature
Affects Version/s: None
Fix Version/s: OpenMRS 1.5.0
There are a large number of "Handler"-type classes which are registered within Spring. For example, we have:
- Validator (handles Objects)
- ReportRenderer (handles ReportSchemas)
- CohortDefinitionPersister (handles CohortDefinitions)
- CohortDefinitionEvaluator (handles CohortDefinitions)
- FieldGenHandler (handles Object)
Each of these "Handlers" has methods which accept a broadly typed parameter (for example, Object), but for which only a small subset of classes that implement this type are valid (for example, a PatientIdentifierValidator has a validate(Object) method, but only is able to successfully operate on a PatientIdentifier parameter.
Often, we have solved this problem through repetitive and error-prone XML configuration. For example, to register ReportRenderers, we have XML that looks like this:<br/>
This XML is unnecessary - we should be able to introspect our codebase to identify the ReportRenderers that are available there.
Spring contains a facility for doing just this. See the attached patch for the proposed addition.