there is too much `if else` going on here. I think you should:

* initialize value with null to make sure it is initialized
* the first if should be `if (context.hasExternalValueSet())`
* can we have a general `validateExternalValue` method that takes a class or so and also accetps null? We can safely cast null into anything. Then you can remove most of the `if` and just step out if `value==null` in line 193
*