Search in sources :

Example 1 with TypeConverter

use of org.gradle.internal.typeconversion.TypeConverter in project gradle by gradle.

the class StructNodeInitializer method getActions.

@Override
public Multimap<ModelActionRole, ModelAction> getActions(ModelReference<?> subject, ModelRuleDescriptor descriptor) {
    return ImmutableSetMultimap.<ModelActionRole, ModelAction>builder().put(ModelActionRole.Discover, DirectNodeInputUsingModelAction.of(subject, descriptor, Arrays.<ModelReference<?>>asList(ModelReference.of(ManagedProxyFactory.class), ModelReference.of(TypeConverter.class)), new BiAction<MutableModelNode, List<ModelView<?>>>() {

        @Override
        public void execute(MutableModelNode modelNode, List<ModelView<?>> modelViews) {
            ManagedProxyFactory proxyFactory = getInstance(modelViews.get(0), ManagedProxyFactory.class);
            TypeConverter typeConverter = getInstance(modelViews, 1, TypeConverter.class);
            for (StructSchema<?> viewSchema : bindings.getDeclaredViewSchemas()) {
                addProjection(modelNode, viewSchema, proxyFactory, typeConverter);
            }
            modelNode.addProjection(new ModelElementProjection(bindings.getPublicSchema().getType()));
        }
    })).put(ModelActionRole.Create, DirectNodeInputUsingModelAction.of(subject, descriptor, Arrays.<ModelReference<?>>asList(ModelReference.of(ModelSchemaStore.class), ModelReference.of(NodeInitializerRegistry.class)), new BiAction<MutableModelNode, List<ModelView<?>>>() {

        @Override
        public void execute(MutableModelNode modelNode, List<ModelView<?>> modelViews) {
            ModelSchemaStore schemaStore = getInstance(modelViews, 0, ModelSchemaStore.class);
            NodeInitializerRegistry nodeInitializerRegistry = getInstance(modelViews, 1, NodeInitializerRegistry.class);
            addPropertyLinks(modelNode, schemaStore, nodeInitializerRegistry);
            initializePrivateData(modelNode);
        }
    })).build();
}
Also used : ManagedProxyFactory(org.gradle.model.internal.manage.instance.ManagedProxyFactory) BiAction(org.gradle.internal.BiAction) TypeConverter(org.gradle.internal.typeconversion.TypeConverter) List(java.util.List)

Aggregations

List (java.util.List)1 BiAction (org.gradle.internal.BiAction)1 TypeConverter (org.gradle.internal.typeconversion.TypeConverter)1 ManagedProxyFactory (org.gradle.model.internal.manage.instance.ManagedProxyFactory)1