use of org.gradle.model.internal.manage.instance.ManagedInstance in project gradle by gradle.
the class NodeBackedModelMap method put.
@Override
public void put(String name, T instance) {
Class<T> type = Cast.uncheckedCast(instance.getClass());
ModelRuleDescriptor descriptor = sourceDescriptor.append("put()");
if (instance instanceof ManagedInstance) {
ManagedInstance target = (ManagedInstance) instance;
modelNode.addReference(name, target.getManagedType(), target.getBackingNode(), descriptor);
} else {
modelNode.addLink(ModelRegistrations.unmanagedInstance(ModelReference.of(modelNode.getPath().child(name), type), Factories.constant(instance)).descriptor(descriptor).build());
}
}
Aggregations