TSelf
- this typepublic abstract class BaseProject<TSelf extends BaseProject<TSelf>> extends Object implements ProjectContext
BasicProject
Constructor and Description |
---|
BaseProject() |
Modifier and Type | Method and Description |
---|---|
protected <T> TSelf |
configure(T object,
TryConsumer<? super T,IOException> configurator)
Configures the given object.
|
Map<String,String> |
environment()
Returns the environment variables.
|
String |
environment(String name)
Returns the environment variable.
|
protected Bundle |
getBundle(Path path)
Returns a project related bundle.
|
CommandLauncher |
getCommandLauncher()
Returns a command launcher of this context.
|
Bundle |
getContents()
Returns the project bundle.
|
protected abstract Path |
getDirectory()
Returns the project directory.
|
TSelf |
gradle(String... tasks)
Launches Gradle tasks.
|
TSelf |
gradle(TryConsumer<? super GradleAdapter,IOException> configurator)
Proceeds Gradle actions on this project.
|
Map<String,String> |
properties()
Returns the system properties.
|
String |
property(String key)
Returns the system property.
|
protected TSelf |
self()
Returns this object.
|
TSelf |
with(Consumer<? super TSelf> configurator)
Configures this project.
|
TSelf |
withContents(TryConsumer<? super Bundle,IOException> configurator)
Returns the project bundle.
|
TSelf |
withEnvironment(Consumer<? super Map<String,String>> configurator)
Sets the environment variables.
|
TSelf |
withEnvironment(String name,
String value)
Puts an environment variable.
|
TSelf |
withProperties(Consumer<? super Map<String,String>> configurator)
Sets the system properties.
|
TSelf |
withProperty(String name,
String value)
Puts an system property.
|
protected TSelf self()
public Map<String,String> environment()
ProjectContext
environment
in interface ProjectContext
public Map<String,String> properties()
ProjectContext
properties
in interface ProjectContext
public String environment(String name)
ProjectContext
environment
in interface ProjectContext
name
- the variable namenull
if it is not definedpublic String property(String key)
ProjectContext
property
in interface ProjectContext
key
- the property keynull
if it is not definedprotected abstract Path getDirectory()
public CommandLauncher getCommandLauncher()
ProjectContext
getCommandLauncher
in interface ProjectContext
public TSelf with(Consumer<? super TSelf> configurator)
configurator
- the configuratorpublic TSelf withEnvironment(String name, String value)
name
- the variable namevalue
- the variable value (nullable)public TSelf withEnvironment(Consumer<? super Map<String,String>> configurator)
configurator
- the configuratorpublic TSelf withProperty(String name, String value)
name
- the variable namevalue
- the variable value (nullable)public TSelf withProperties(Consumer<? super Map<String,String>> configurator)
configurator
- the configuratorpublic Bundle getContents()
public TSelf withContents(TryConsumer<? super Bundle,IOException> configurator)
configurator
- the project configuratorpublic TSelf gradle(String... tasks)
tasks
- the task namesgradle(TryConsumer)
public TSelf gradle(TryConsumer<? super GradleAdapter,IOException> configurator)
configurator
- the Gradle action configuratorgradle(String...)
protected Bundle getBundle(Path path)
path
- the bundle pathprotected <T> TSelf configure(T object, TryConsumer<? super T,IOException> configurator)
T
- the object typeobject
- the target objectconfigurator
- the object configuratorCopyright © 2011–2019 Asakusa Framework Team. All rights reserved.