public void call(Parameterized parameterized)
{
Set<String> names = parameterized.getRequiredParameterNames();
if (rule instanceof RuleBuilder)
{
ParameterStore store = ((RuleBuilder) rule).getParameterStore();
for (Entry<String, Parameter<?>> entry : parent) {
String name = entry.getKey();
Parameter<?> parentParam = entry.getValue();
if (!store.contains(name)) {
store.get(name, parentParam);
}
else
{
Parameter<?> parameter = store.get(name);
for (Binding binding : parameter.getBindings()) {
if (!parentParam.getBindings().contains(binding))
throwRedefinitionError(rule, name);
}
for (Constraint<?> constraint : parameter.getConstraints()) {
if (!parentParam.getConstraints().contains(constraint))
throwRedefinitionError(rule, name);
}
for (Transposition<?> transposition : parameter.getTranspositions()) {
if (!parentParam.getTranspositions().contains(transposition))
throwRedefinitionError(rule, name);
}
if (parentParam.getConverter() != null
&& !parentParam.getConverter().equals(parameter.getConverter()))
throwRedefinitionError(rule, name);
if (parentParam.getValidator() != null
&& !parentParam.getValidator().equals(parameter.getValidator()))
throwRedefinitionError(rule, name);
}
}
for (String name : names) {
Parameter<?> parameter = store.get(name, new DefaultParameter(name));
if (parameter instanceof ConfigurableParameter<?>)
((ConfigurableParameter<?>) parameter).bindsTo(Evaluation.property(name));
}
parameterized.setParameterStore(store);
}