Search in sources :

Example 1 with NodeInitializer

use of org.gradle.model.internal.core.NodeInitializer in project gradle by gradle.

the class NonTransformedModelDslBacking method register.

private <T> void register(Class<T> type, Action<? super T> action) {
    ModelRuleDescriptor descriptor = new SimpleModelRuleDescriptor("model." + modelPath);
    NodeInitializerRegistry nodeInitializerRegistry = modelRegistry.realize(DEFAULT_REFERENCE.getPath(), DEFAULT_REFERENCE.getType());
    ModelType<T> modelType = ModelType.of(type);
    NodeInitializer nodeInitializer = nodeInitializerRegistry.getNodeInitializer(forType(modelType));
    modelRegistry.register(ModelRegistrations.of(modelPath, nodeInitializer).descriptor(descriptor).action(ModelActionRole.Initialize, NoInputsModelAction.of(ModelReference.of(modelPath, modelType), descriptor, action)).build());
}
Also used : NodeInitializer(org.gradle.model.internal.core.NodeInitializer) NodeInitializerRegistry(org.gradle.model.internal.core.NodeInitializerRegistry) SimpleModelRuleDescriptor(org.gradle.model.internal.core.rule.describe.SimpleModelRuleDescriptor) ModelRuleDescriptor(org.gradle.model.internal.core.rule.describe.ModelRuleDescriptor) SimpleModelRuleDescriptor(org.gradle.model.internal.core.rule.describe.SimpleModelRuleDescriptor)

Aggregations

NodeInitializer (org.gradle.model.internal.core.NodeInitializer)1 NodeInitializerRegistry (org.gradle.model.internal.core.NodeInitializerRegistry)1 ModelRuleDescriptor (org.gradle.model.internal.core.rule.describe.ModelRuleDescriptor)1 SimpleModelRuleDescriptor (org.gradle.model.internal.core.rule.describe.SimpleModelRuleDescriptor)1