Class AbstractProject
- All Implemented Interfaces:
Project, ResourceProvider
- Direct Known Subclasses:
BootstrapBuild, BootstrapRoot
Project.-
Nested Class Summary
Nested classes/interfaces inherited from interface Project
Project.Properties -
Field Summary
Fields inherited from class AbstractProvider
log -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedAbstractProject(NamedParameter<?>... params) Base class constructor for all projects. -
Method Summary
Modifier and TypeMethodDescriptioncommandAlias(String name, ResourceRequest<?>... requests) Define command, seeRootProject.commandAlias(String, ResourceRequest...).context()Returns the build context.dependency(Intend intend, ResourceProvider provider) Adds a provider that contributes resources to the project with the given intended usage.Returns the project's directory.protected static NamedParameter<Path> Named parameter for specifying the directory.doProvide(ResourceRequest<R> requested) A project itself does not provide any resources.booleanGenerator.<T> Tget(PropertyKey property) Returns value of the given property of the project.inthashCode()protected static NamedParameter<Path> Hack to passcontext().jdbldDirectory()as named parameter for the directory to the constructor.name()Returns the project's name.protected static NamedParameter<String> Named parameter for specifying the name.protected static NamedParameter<Class<? extends Project>> Named parameter for specifying the parent project.Returns the instance of the given project class.Returns the providers that have been added with one of the given intended usages asStream.final RootProjectReturns the root project.set(PropertyKey property, Object value) Sets the given property to the given value.toString()To string.Methods inherited from class AbstractProvider
provideMethods inherited from interface Project
buildDirectory, dependency, from, from, from, generator, get, newResource, provided, providers, readString, relativizeMethods inherited from interface ResourceProvider
provide
-
Constructor Details
-
AbstractProject
Base class constructor for all projects. The behavior depends on whether the project is a root project (implements
RootProject) or a subproject and on whether the project specifies a parent project.RootProjects must invoke this constructor with a null parent project class.A sub project that wants to specify a parent project must invoke this constructor with the parent project's class. If a sub project does not specify a parent project, the root project is used as parent. In both cases, the constructor adds a
Intend.Forwarddependency between the parent project and the new project. This can then be overridden in the sub project's constructor.- Parameters:
params-the named parameters
- parent - the class of the parent project
- name - the name of the project. If not provided the name is set to the (simple) class name
- directory - the directory of the project. If not provided, the directory is set to the name with uppercase letters converted to lowercase for subprojects. For root projects the directory is always set to the current working
-
-
Method Details
-
parent
-
name
Named parameter for specifying the name.- Parameters:
name- the name- Returns:
- the named parameter
-
directory
Named parameter for specifying the directory.- Parameters:
directory- the directory- Returns:
- the named parameter
-
jdbldDirectory
Hack to passcontext().jdbldDirectory()as named parameter for the directory to the constructor. This is required because you cannot "refer to an instance method while explicitly invoking a constructor".- Returns:
- the named parameter
-
rootProject
Description copied from interface:ProjectReturns the root project.- Specified by:
rootProjectin interfaceProject- Returns:
- the project
-
project
Description copied from interface:ProjectReturns the instance of the given project class. Projects are created lazily by the builder and must be accessed via this method. -
name
-
directory
-
generator
-
dependency
Description copied from interface:ProjectAdds a provider that contributes resources to the project with the given intended usage.
While this could be used to add a
Generatorto the project as a provider withIntend.Supply, it is recommended to use one of the "generator" methods for better readability.- Specified by:
dependencyin interfaceProject- Parameters:
intend- the dependency typeprovider- the provider- Returns:
- the project for method chaining
- See Also:
-
providers
-
context
Description copied from interface:ProjectReturns the build context. -
get
Description copied from interface:ProjectReturns value of the given property of the project. If the property is not set, the parent project's value is returned. If neither is set, the property's default value is returned. -
set
Description copied from interface:ProjectSets the given property to the given value.
Regrettably, there is no way to enforce at compile time that the type of the value passed to
setmatches the type of the property. An implementation must check this at runtime by verifying that the given value is assignable to the default value. -
doProvide
A project itself does not provide any resources. Rather, requests for resources are forwarded to the project's providers with intendIntend.Forward,Intend.ExposeorIntend.Supply.- Specified by:
doProvidein classAbstractProvider- Type Parameters:
R- the generic type- Parameters:
requested- the requested- Returns:
- the provided resources
-
commandAlias
Define command, seeRootProject.commandAlias(String, ResourceRequest...).- Parameters:
name- the namerequests- the requests- Returns:
- the root project
-
hashCode
-
equals
-
toString
To string.- Overrides:
toStringin classAbstractProvider- Returns:
- the string
-