Data Path

back to index

The type of the value to assign to some property can be very different from the type of the property itself. For example, HTTP parameters are always sent as Strings, regardless of the fact that they are trying to represent numbers, dates, etc.

Also, different annotations have different requirements. For example, a Javadoc reference @MaxDigits annotation requires to be provided a number (although the type of the number -byte, float, BigDecimal - is irrelevant). (By the way, the preferences of each annotation are -in turn- specified in a meta-annotation called Javadoc reference @Accepts)

When the system has to apply a series of annotations to a field, it creates a Data Path. A data path starts with the first annotation present in an object property and ends with the property itself. Each portion of the data path is called a DataStep (Javadoc referenceDataStep). Each DataStep has the following information:

When moving data from one data step to another, the shell checks if the output from one data step is among the valid input types of the next step. The same check is performed during the last - assignment - step, when the final resulting value is to be assigned to the target property. If the type is allowed by the next step, the shell transfers it directly. Otherwise, it tries to locate a converter that is able to convert from the current type to any of the input types that the next step requires. If no converter is found, an error is logged and the process ends.

 

dynject data path