Java 类org.gradle.api.NamedDomainObjectFactory 实例源码

项目:Reer    文件:MicrosoftVisualCppCompilerPlugin.java   
@Defaults
public static void addToolChain(NativeToolChainRegistryInternal toolChainRegistry, ServiceRegistry serviceRegistry) {
    final FileResolver fileResolver = serviceRegistry.get(FileResolver.class);
    final ExecActionFactory execActionFactory = serviceRegistry.get(ExecActionFactory.class);
    final Instantiator instantiator = serviceRegistry.get(Instantiator.class);
    final OperatingSystem operatingSystem = serviceRegistry.get(OperatingSystem.class);
    final BuildOperationProcessor buildOperationProcessor = serviceRegistry.get(BuildOperationProcessor.class);
    final VisualStudioLocator visualStudioLocator = serviceRegistry.get(VisualStudioLocator.class);
    final UcrtLocator ucrtLocator = serviceRegistry.get(UcrtLocator.class);
    final WindowsSdkLocator windowsSdkLocator = serviceRegistry.get(WindowsSdkLocator.class);

    toolChainRegistry.registerFactory(VisualCpp.class, new NamedDomainObjectFactory<VisualCpp>() {
        public VisualCpp create(String name) {
        return instantiator.newInstance(VisualCppToolChain.class, name, buildOperationProcessor, operatingSystem, fileResolver, execActionFactory, visualStudioLocator, windowsSdkLocator, ucrtLocator, instantiator);
        }
    });
    toolChainRegistry.registerDefaultToolChain(VisualCppToolChain.DEFAULT_NAME, VisualCpp.class);
}
项目:Reer    文件:GccCompilerPlugin.java   
@Defaults
public static void addToolChain(NativeToolChainRegistryInternal toolChainRegistry, ServiceRegistry serviceRegistry) {
    final FileResolver fileResolver = serviceRegistry.get(FileResolver.class);
    final ExecActionFactory execActionFactory = serviceRegistry.get(ExecActionFactory.class);
    final Instantiator instantiator = serviceRegistry.get(Instantiator.class);

    final BuildOperationProcessor buildOperationProcessor = serviceRegistry.get(BuildOperationProcessor.class);

    final CompilerMetaDataProviderFactory metaDataProviderFactory = serviceRegistry.get(CompilerMetaDataProviderFactory.class);

    toolChainRegistry.registerFactory(Gcc.class, new NamedDomainObjectFactory<Gcc>() {
        public Gcc create(String name) {
            return instantiator.newInstance(GccToolChain.class, instantiator, name, buildOperationProcessor, OperatingSystem.current(), fileResolver, execActionFactory, metaDataProviderFactory);
        }
    });
    toolChainRegistry.registerDefaultToolChain(GccToolChain.DEFAULT_NAME, Gcc.class);
}
项目:Pushjet-Android    文件:MicrosoftVisualCppPlugin.java   
@Mutate
public static void addGccToolChain(NativeToolChainRegistryInternal toolChainRegistry, ServiceRegistry serviceRegistry) {
    final FileResolver fileResolver = serviceRegistry.get(FileResolver.class);
    final ExecActionFactory execActionFactory = serviceRegistry.get(ExecActionFactory.class);
    final Instantiator instantiator = serviceRegistry.get(Instantiator.class);
    final OperatingSystem operatingSystem = serviceRegistry.get(OperatingSystem.class);
    final VisualStudioLocator visualStudioLocator = serviceRegistry.get(VisualStudioLocator.class);
    final WindowsSdkLocator windowsSdkLocator = serviceRegistry.get(WindowsSdkLocator.class);

    toolChainRegistry.registerFactory(VisualCpp.class, new NamedDomainObjectFactory<VisualCpp>() {
        public VisualCpp create(String name) {
            return instantiator.newInstance(VisualCppToolChain.class, name, operatingSystem, fileResolver, execActionFactory, visualStudioLocator, windowsSdkLocator, instantiator);
        }
    });
    toolChainRegistry.registerDefaultToolChain(VisualCppToolChain.DEFAULT_NAME, VisualCpp.class);
}
项目:Reer    文件:DefaultConfigurationPublications.java   
@Override
public NamedDomainObjectContainer<ConfigurationVariant> getVariants() {
    if (variants == null) {
        // Create variants container only as required
        variants = new FactoryNamedDomainObjectContainer<ConfigurationVariant>(ConfigurationVariant.class, instantiator, new NamedDomainObjectFactory<ConfigurationVariant>() {
            @Override
            public ConfigurationVariant create(String name) {
                return instantiator.newInstance(DefaultVariant.class, name, parentAttributes, artifactNotationParser, fileCollectionFactory);
            }
        });
    }
    return variants;
}
项目:Reer    文件:ClangCompilerPlugin.java   
@Defaults
public static void addToolChain(NativeToolChainRegistryInternal toolChainRegistry, ServiceRegistry serviceRegistry) {
    final FileResolver fileResolver = serviceRegistry.get(FileResolver.class);
    final ExecActionFactory execActionFactory = serviceRegistry.get(ExecActionFactory.class);
    final Instantiator instantiator = serviceRegistry.get(Instantiator.class);
    final BuildOperationProcessor buildOperationProcessor = serviceRegistry.get(BuildOperationProcessor.class);
    final CompilerMetaDataProviderFactory metaDataProviderFactory = serviceRegistry.get(CompilerMetaDataProviderFactory.class);

    toolChainRegistry.registerFactory(Clang.class, new NamedDomainObjectFactory<Clang>() {
        public Clang create(String name) {
            return instantiator.newInstance(ClangToolChain.class, name, buildOperationProcessor, OperatingSystem.current(), fileResolver, execActionFactory, metaDataProviderFactory, instantiator);
        }
    });
    toolChainRegistry.registerDefaultToolChain(ClangToolChain.DEFAULT_NAME, Clang.class);
}
项目:Reer    文件:NativeComponentModelPlugin.java   
@Defaults
public void registerFactoryForCustomNativePlatforms(PlatformContainer platforms, final Instantiator instantiator) {
    NamedDomainObjectFactory<NativePlatform> nativePlatformFactory = new NamedDomainObjectFactory<NativePlatform>() {
        public NativePlatform create(String name) {
            return instantiator.newInstance(DefaultNativePlatform.class, name);
        }
    };

    platforms.registerFactory(NativePlatform.class, nativePlatformFactory);

    platforms.registerFactory(Platform.class, nativePlatformFactory);
}
项目:Reer    文件:NativeComponentModelPlugin.java   
private DefaultRepositories(final Instantiator instantiator, final SourceDirectorySetFactory sourceDirectorySetFactory, final Action<PrebuiltLibrary> binaryFactory) {
    super(ArtifactRepository.class, instantiator, new ArtifactRepositoryNamer());
    registerFactory(PrebuiltLibraries.class, new NamedDomainObjectFactory<PrebuiltLibraries>() {
        public PrebuiltLibraries create(String name) {
            return instantiator.newInstance(DefaultPrebuiltLibraries.class, name, instantiator, sourceDirectorySetFactory, binaryFactory);
        }
    });
}
项目:Reer    文件:DefaultPolymorphicNamedEntityInstantiator.java   
public <S extends T> S create(String name, Class<S> type) {
    @SuppressWarnings("unchecked")
    NamedDomainObjectFactory<S> factory = (NamedDomainObjectFactory<S>) factories.get(type);
    if (factory == null) {
        throw new InvalidUserDataException(
                String.format("Cannot create a %s because this type is not known to %s. Known types are: %s", type.getSimpleName(), displayName, getSupportedTypeNames()),
                new NoFactoryRegisteredForTypeException());
    }
    return factory.create(name);
}
项目:Reer    文件:DefaultPolymorphicNamedEntityInstantiator.java   
@Override
public <U extends T> void registerFactory(Class<U> type, NamedDomainObjectFactory<? extends U> factory) {
    if (!baseType.isAssignableFrom(type)) {
        String message = String.format("Cannot register a factory for type %s because it is not a subtype of container element type %s.", type.getSimpleName(), baseType.getSimpleName());
        throw new IllegalArgumentException(message);
    }
    if(factories.containsKey(type)){
        throw new GradleException(String.format("Cannot register a factory for type %s because a factory for this type is already registered.", type.getSimpleName()));
    }
    factories.put(type, factory);
}
项目:goomph    文件:EquinoxLaunchPlugin.java   
@Override
protected void applyOnce(Project project) {
    project.getExtensions().add(NAME, project.container(EquinoxLaunchSetupTask.class, new NamedDomainObjectFactory<EquinoxLaunchSetupTask>() {
        @Override
        public EquinoxLaunchSetupTask create(String name) {
            EquinoxLaunchSetupTask setupTask = project.getTasks().create(name, EquinoxLaunchSetupTask.class);
            setupTask.setInstallDir(new File(project.getBuildDir(), name));
            return setupTask;
        }
    }));
}
项目:Pushjet-Android    文件:ComponentTypeRuleDefinitionHandler.java   
private <T extends ComponentSpec, I extends BaseComponentSpec> void doRegister(final ModelType<T> type, final ModelType<I> implementation, final ProjectSourceSet projectSourceSet, ComponentSpecContainer componentSpecs, final ProjectIdentifier projectIdentifier) {
    componentSpecs.registerFactory(type.getConcreteClass(), new NamedDomainObjectFactory<T>() {
        public T create(String name) {
            FunctionalSourceSet componentSourceSet = projectSourceSet.maybeCreate(name);
            ComponentSpecIdentifier id = new DefaultComponentSpecIdentifier(projectIdentifier.getPath(), name);

            // safe because we implicitly know that U extends V, but can't express this in the type system
            @SuppressWarnings("unchecked")
            T created = (T) BaseComponentSpec.create(implementation.getConcreteClass(), id, componentSourceSet, instantiator);

            return created;
        }
    });
}
项目:Pushjet-Android    文件:BinaryTypeRuleDefinitionHandler.java   
private <T extends BinarySpec, U extends BaseBinarySpec> void doRegister(BinaryContainer binaries, ModelType<T> type, final ModelType<U> implementation) {
    binaries.registerFactory(type.getConcreteClass(), new NamedDomainObjectFactory<T>() {
        public T create(String name) {
            BinaryNamingScheme binaryNamingScheme = new DefaultBinaryNamingSchemeBuilder()
                    .withComponentName(name)
                    .build();

            // safe because we implicitly know that U extends V, but can't express this in the type system
            @SuppressWarnings("unchecked")
            T created = (T) BaseBinarySpec.create(implementation.getConcreteClass(), binaryNamingScheme, instantiator);

            return created;
        }
    });
}
项目:Pushjet-Android    文件:ClangCompilerPlugin.java   
@Mutate
public static void addToolChain(NativeToolChainRegistryInternal toolChainRegistry, ServiceRegistry serviceRegistry) {
    final FileResolver fileResolver = serviceRegistry.get(FileResolver.class);
    final ExecActionFactory execActionFactory = serviceRegistry.get(ExecActionFactory.class);
    final Instantiator instantiator = serviceRegistry.get(Instantiator.class);
    final CompilerMetaDataProviderFactory metaDataProviderFactory = serviceRegistry.get(CompilerMetaDataProviderFactory.class);

    toolChainRegistry.registerFactory(Clang.class, new NamedDomainObjectFactory<Clang>() {
        public Clang create(String name) {
            return instantiator.newInstance(ClangToolChain.class, name, OperatingSystem.current(), fileResolver, execActionFactory, metaDataProviderFactory, instantiator);
        }
    });
    toolChainRegistry.registerDefaultToolChain(ClangToolChain.DEFAULT_NAME, Clang.class);
}
项目:Pushjet-Android    文件:GccCompilerPlugin.java   
@Mutate
public static void addGccToolChain(NativeToolChainRegistryInternal toolChainRegistry, ServiceRegistry serviceRegistry) {
    final FileResolver fileResolver = serviceRegistry.get(FileResolver.class);
    final ExecActionFactory execActionFactory = serviceRegistry.get(ExecActionFactory.class);
    final Instantiator instantiator = serviceRegistry.get(Instantiator.class);
    final CompilerMetaDataProviderFactory metaDataProviderFactory = serviceRegistry.get(CompilerMetaDataProviderFactory.class);

    toolChainRegistry.registerFactory(Gcc.class, new NamedDomainObjectFactory<Gcc>() {
        public Gcc create(String name) {
            return instantiator.newInstance(GccToolChain.class, instantiator, name, OperatingSystem.current(), fileResolver, execActionFactory, metaDataProviderFactory);
        }
    });
    toolChainRegistry.registerDefaultToolChain(GccToolChain.DEFAULT_NAME, Gcc.class);
}
项目:Pushjet-Android    文件:RepositoriesFactory.java   
private DefaultRepositories(final Instantiator instantiator, final FileResolver fileResolver, final Action<PrebuiltLibrary> binaryFactory) {
    super(ArtifactRepository.class, instantiator, new ArtifactRepositoryNamer());
    registerFactory(PrebuiltLibraries.class, new NamedDomainObjectFactory<PrebuiltLibraries>() {
        public PrebuiltLibraries create(String name) {
            return instantiator.newInstance(DefaultPrebuiltLibraries.class, name, instantiator, fileResolver, binaryFactory);
        }
    });
}
项目:Reer    文件:DefaultProject.java   
public <T> NamedDomainObjectContainer<T> container(Class<T> type, NamedDomainObjectFactory<T> factory) {
    Instantiator instantiator = getServices().get(Instantiator.class);
    return instantiator.newInstance(FactoryNamedDomainObjectContainer.class, type, instantiator, new DynamicPropertyNamer(), factory);
}
项目:Reer    文件:DefaultPolymorphicNamedEntityInstantiator.java   
<U extends T> void copyFactory(DefaultPolymorphicNamedEntityInstantiator<T> source, Class<U> type) {
    NamedDomainObjectFactory<U> factory = uncheckedCast(source.factories.get(type));
    registerFactory(type, factory);
}
项目:Pushjet-Android    文件:RuleAwarePolymorphicDomainObjectContainer.java   
@Override
public <U extends T> void registerFactory(Class<U> type, NamedDomainObjectFactory<? extends U> factory) {
    checkCanRegister(type);
    super.registerFactory(type, factory);
}
项目:Reer    文件:FactoryNamedDomainObjectContainer.java   
/**
 * <p>Creates a container that instantiates using the given factory.<p>
 *
 * @param type The concrete type of element in the container (must implement {@link Named})
 * @param instantiator The instantiator to use to create any other collections based on this one
 * @param factory The factory responsible for creating new instances on demand
 */
public FactoryNamedDomainObjectContainer(Class<T> type, Instantiator instantiator, NamedDomainObjectFactory<T> factory) {
    this(type, instantiator, Named.Namer.forType(type), factory);
}
项目:Reer    文件:FactoryNamedDomainObjectContainer.java   
/**
 * <p>Creates a container that instantiates using the given factory.<p>
 *
 * @param type The concrete type of element in the container
 * @param instantiator The instantiator to use to create any other collections based on this one
 * @param namer The naming strategy to use
 * @param factory The factory responsible for creating new instances on demand
 */
public FactoryNamedDomainObjectContainer(Class<T> type, Instantiator instantiator, Namer<? super T> namer, NamedDomainObjectFactory<T> factory) {
    super(type, instantiator, namer);
    this.factory = factory;
}
项目:Pushjet-Android    文件:FactoryNamedDomainObjectContainer.java   
/**
 * <p>Creates a container that instantiates using the given factory.<p>
 *
 * @param type The concrete type of element in the container (must implement {@link Named})
 * @param instantiator The instantiator to use to create any other collections based on this one
 * @param factory The factory responsible for creating new instances on demand
 */
public FactoryNamedDomainObjectContainer(Class<T> type, Instantiator instantiator, NamedDomainObjectFactory<T> factory) {
    this(type, instantiator, Named.Namer.forType(type), factory);
}
项目:Pushjet-Android    文件:FactoryNamedDomainObjectContainer.java   
/**
 * <p>Creates a container that instantiates using the given factory.<p>
 *
 * @param type The concrete type of element in the container
 * @param instantiator The instantiator to use to create any other collections based on this one
 * @param namer The naming strategy to use
 * @param factory The factory responsible for creating new instances on demand
 */
public FactoryNamedDomainObjectContainer(Class<T> type, Instantiator instantiator, Namer<? super T> namer, NamedDomainObjectFactory<T> factory) {
    super(type, instantiator, namer);
    this.factory = factory;
}
项目:Pushjet-Android    文件:FactoryNamedDomainObjectContainer.java   
/**
 * <p>Creates a container that instantiates using the given factory.<p>
 *
 * @param type The concrete type of element in the container (must implement {@link Named})
 * @param instantiator The instantiator to use to create any other collections based on this one
 * @param factory The factory responsible for creating new instances on demand
 */
public FactoryNamedDomainObjectContainer(Class<T> type, Instantiator instantiator, NamedDomainObjectFactory<T> factory) {
    this(type, instantiator, Named.Namer.forType(type), factory);
}
项目:Pushjet-Android    文件:FactoryNamedDomainObjectContainer.java   
/**
 * <p>Creates a container that instantiates using the given factory.<p>
 *
 * @param type The concrete type of element in the container
 * @param instantiator The instantiator to use to create any other collections based on this one
 * @param namer The naming strategy to use
 * @param factory The factory responsible for creating new instances on demand
 */
public FactoryNamedDomainObjectContainer(Class<T> type, Instantiator instantiator, Namer<? super T> namer, NamedDomainObjectFactory<T> factory) {
    super(type, instantiator, namer);
    this.factory = factory;
}
项目:Reer    文件:NamedDomainObjectFactoryRegistry.java   
<U extends T> void registerFactory(Class<U> type, NamedDomainObjectFactory<? extends U> factory);