return new BoundParameterFieldValueConduit(containerParameterName, containerResources, fieldType);
}
private String identifyParameterName(ComponentResources resources, String firstGuess, String... otherGuesses)
{
ComponentModel model = resources.getContainerResources().getComponentModel();
List<String> guesses = CollectionFactory.newList();
guesses.add(firstGuess);
for (String name : otherGuesses)
{
guesses.add(name);
}
for (String name : guesses)
{
if (model.isFormalParameter(name))
return name;
if(isPublishedParameter(model, name))
return name;
}
String message = String.format("Containing component %s does not contain a formal parameter or a published parameter %s %s.",
model.getComponentClassName(),
guesses.size() == 1 ? "matching" : "matching any of",
InternalUtils.joinSorted(guesses));
List<String> formalAndPublishedParameters = CollectionFactory.newList(model.getParameterNames());
formalAndPublishedParameters.addAll(getPublishedParameters(model));
throw new UnknownValueException(message, new AvailableValues("Formal and published parameters", formalAndPublishedParameters));
}