return new ComputedValue<FieldConduit<Object>>()
{
public FieldConduit<Object> get(InstanceContext context)
{
final Class fieldType = cache.forName(fieldTypeName);
final ComponentResources resources = context.get(ComponentResources.class);
return new ReadOnlyComponentFieldConduit(resources, fieldName)
{
public Object get(Object instance, InstanceContext context)
{
Component container = resources.getContainer();
if (!fieldType.isInstance(container))
{
String message = String.format(
"Component %s (type %s) is not assignable to field %s.%s (of type %s).", container
.getComponentResources().getCompleteId(), container.getClass().getName(), resources.getComponentModel()
.getComponentClassName(), fieldName, fieldTypeName);
throw new RuntimeException(message);
}