+ // Validate execution specs
+ if (executionSpec == null)
+ return;
+
+ MapBindingResult errors = new MapBindingResult(attributes, "execution#"
+ + getUuid());
+ for (String key : executionSpec.getAttributes().keySet()) {
+ ExecutionSpecAttribute executionSpecAttr = executionSpec
+ .getAttributes().get(key);
+ if (!attributes.containsKey(key)) {
+ Object defaultValue = executionSpecAttr.getValue();
+ if (defaultValue == null)
+ errors.rejectValue(key, "Not set and no default value");
+ else
+ attributes.put(key, defaultValue);
+ } else {// contains key
+ Object obj = attributes.get(key);
+ if (executionSpecAttr instanceof RefSpecAttribute) {
+ RefSpecAttribute rsa = (RefSpecAttribute) executionSpecAttr;
+ Class targetClass = rsa.getTargetClass();
+ if (!targetClass.isAssignableFrom(obj.getClass()))
+ errors.rejectValue(key,
+ "Not compatible with target class "
+ + targetClass);
+ }
+ }
+ }