public class ProjectGenerator extends Object
ProjectDescription by
creating a dedicated ProjectGenerationContext with all available
ProjectGenerationConfiguration classes. Once the context has been started for a
particular ProjectDescription, a ProjectAssetGenerator can query it and
generate an appropriate asset (for instance, a project structure on disk).| Constructor and Description |
|---|
ProjectGenerator(Consumer<ProjectGenerationContext> contextConsumer)
Create an instance with a customizer for the
ProjectGenerationContext and a
default factory for the ProjectGenerationContext that disables bean
definition overriding. |
ProjectGenerator(Consumer<ProjectGenerationContext> contextConsumer,
Supplier<? extends ProjectGenerationContext> contextFactory)
Create an instance with a customizer for the project generator application context
and a factory for the
ProjectGenerationContext. |
| Modifier and Type | Method and Description |
|---|---|
<T> T |
generate(ProjectDescription description,
ProjectAssetGenerator<T> projectAssetGenerator)
Generate project assets using the specified
ProjectAssetGenerator for the
specified ProjectDescription. |
protected List<String> |
getCandidateProjectGenerationConfigurations(ProjectDescription description)
Return the
ProjectGenerationConfiguration class names that should be
considered. |
public ProjectGenerator(Consumer<ProjectGenerationContext> contextConsumer, Supplier<? extends ProjectGenerationContext> contextFactory)
ProjectGenerationContext.contextConsumer - a consumer of the project generation context after
contributors and the ProjectDescription have been registered but before it
is refreshedcontextFactory - the factory to use to create ProjectGenerationContext
instancespublic ProjectGenerator(Consumer<ProjectGenerationContext> contextConsumer)
ProjectGenerationContext and a
default factory for the ProjectGenerationContext that disables bean
definition overriding.contextConsumer - a consumer of the project generation context after
contributors and the ProjectDescription have been registered but before it
is refreshedGenericApplicationContext.setAllowBeanDefinitionOverriding(boolean)public <T> T generate(ProjectDescription description, ProjectAssetGenerator<T> projectAssetGenerator) throws ProjectGenerationException
ProjectAssetGenerator for the
specified ProjectDescription.
Create a dedicated ProjectGenerationContext using the supplied
contextFactory and then apply the
following:
ProjectDescription bean based on the given
description post-processed by available
ProjectDescriptionCustomizer beans.ProjectGenerationConfiguration classes.contextConsumer to
further customize the context before it is refreshed.T - the type that gathers the project assetsdescription - the description of the project to generateprojectAssetGenerator - the ProjectAssetGenerator to invokeProjectGenerationException - if an error occurs while generating the projectprotected List<String> getCandidateProjectGenerationConfigurations(ProjectDescription description)
ProjectGenerationConfiguration class names that should be
considered. By default this method will load candidates using
SpringFactoriesLoader with ProjectGenerationConfiguration.description - the description of the project to generateCopyright © 2021 Pivotal Software, Inc.. All rights reserved.