APP - the type that is being builtBUILDER - the (self) type of the AbstractApplicationBuilderpublic abstract class AbstractApplicationBuilder<APP extends Speedment,BUILDER extends AbstractApplicationBuilder<APP,BUILDER>> extends Object implements ApplicationBuilder<APP,BUILDER>
Speedment application.ApplicationBuilder.HasLoggerName, ApplicationBuilder.LogType| Modifier | Constructor and Description |
|---|---|
protected |
AbstractApplicationBuilder(Class<? extends APP> applicationImplClass,
Class<? extends ApplicationMetadata> metadataClass) |
protected |
AbstractApplicationBuilder(ClassLoader classLoader,
Class<? extends APP> applicationImplClass,
Class<? extends ApplicationMetadata> metadataClass) |
protected |
AbstractApplicationBuilder(com.speedment.common.injector.InjectorBuilder injectorBuilder) |
| Modifier and Type | Method and Description |
|---|---|
APP |
build()
Builds this application.
|
protected abstract APP |
build(com.speedment.common.injector.Injector injector)
Builds the application using the specified injector.
|
protected void |
checkDatabaseConnectivity(com.speedment.common.injector.Injector injector) |
protected void |
printWelcomeMessage(com.speedment.common.injector.Injector injector)
Prints a welcome message to the output channel.
|
protected void |
validateRuntimeConfig(com.speedment.common.injector.Injector injector) |
<C extends com.speedment.runtime.config.Document & com.speedment.runtime.config.trait.HasEnabled> |
with(Class<C> type,
BiConsumer<com.speedment.common.injector.Injector,C> consumer)
Configures a parameter for all
Document of a certain class. |
<C extends com.speedment.runtime.config.Document & com.speedment.runtime.config.trait.HasEnabled> |
with(Class<C> type,
Consumer<C> consumer)
Configures a parameter for all
Document of a certain class. |
<C extends com.speedment.runtime.config.Document & com.speedment.runtime.config.trait.HasEnabled> |
with(Class<C> type,
String name,
BiConsumer<com.speedment.common.injector.Injector,C> consumer)
Configures a parameter for the named
Document of a certain class. |
BUILDER |
withAllowStreamIteratorAndSpliterator()
Allows
BaseStream.iterator() and
BaseStream.spliterator() terminating operations to
be called on Speedment streams. |
BUILDER |
withBundle(Class<? extends com.speedment.common.injector.InjectBundle> bundleClass)
Adds a custom bundle of dependency injectable implementation classes.
|
BUILDER |
withComponent(Class<?> injectableClass)
Adds a custom component implementation class.
|
<T> BUILDER |
withComponent(Class<T> injectableClass,
Supplier<T> supplier) |
BUILDER |
withConnectionUrl(String connectionUrl)
Configures a connection URL for all dbmses in this project.
|
BUILDER |
withConnectionUrl(String dbmsName,
String connectionUrl)
Configures a connection URL for the named dbms in this project.
|
BUILDER |
withIpAddress(String ipAddress)
Configures an IP-address for all dbmses in this project.
|
BUILDER |
withIpAddress(String dbmsName,
String ipAddress)
Configures an IP-address for the named dbms.
|
BUILDER |
withLogging(ApplicationBuilder.HasLoggerName namer)
Adds a logging configuration to the application.
|
<M extends Manager<?>> |
withManager(Class<M> managerImplType)
Adds a custom manager.
|
BUILDER |
withParam(String key,
String value)
Sets a config parameter that will be set automatically in all instances
created during initialization.
|
BUILDER |
withPassword(char[] password)
Configures a password for all dbmses in this project.
|
BUILDER |
withPassword(String password)
Configures a password for all dbmses in this project.
|
BUILDER |
withPassword(String dbmsName,
char[] password)
Configures a password for the named dbms.
|
BUILDER |
withPassword(String dbmsName,
String password)
Configures a password for the named dbms.
|
BUILDER |
withPort(int port)
Configures a port for all dbmses in this project.
|
BUILDER |
withPort(String dbmsName,
int port)
Configures a port for the named dbms.
|
BUILDER |
withSchema(String schemaName)
Configures a new schema name for all schemas in this project.
|
BUILDER |
withSchema(String oldSchemaName,
String schemaName)
Configures a new schema name for the named old schema name.
|
BUILDER |
withSkipCheckDatabaseConnectivity()
Sets that the initial database check shall be skipped upon build().
|
BUILDER |
withSkipLogoPrintout()
Sets that the logo printout shall be skipped upon build().
|
BUILDER |
withSkipValidateRuntimeConfig()
Sets that the initial validation of the configuration shall be skipped
upon build().
|
BUILDER |
withUsername(String username)
Configures a username for all dbmses in this project.
|
BUILDER |
withUsername(String dbmsName,
String username)
Configures a username for the named dbms.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitwith, withColumn, withColumn, withConnectionUrl, withDbms, withDbms, withIpAddress, withPassword, withPassword, withPort, withSchema, withSchema, withTable, withTable, withUsernameprotected AbstractApplicationBuilder(Class<? extends APP> applicationImplClass, Class<? extends ApplicationMetadata> metadataClass)
protected AbstractApplicationBuilder(ClassLoader classLoader, Class<? extends APP> applicationImplClass, Class<? extends ApplicationMetadata> metadataClass)
protected AbstractApplicationBuilder(com.speedment.common.injector.InjectorBuilder injectorBuilder)
public <C extends com.speedment.runtime.config.Document & com.speedment.runtime.config.trait.HasEnabled> BUILDER with(Class<C> type, String name, BiConsumer<com.speedment.common.injector.Injector,C> consumer)
ApplicationBuilderDocument of a certain class.
The consumer will then be applied after the configuration has been read
and after the System properties have been applied.with in interface ApplicationBuilder<APP extends Speedment,BUILDER extends AbstractApplicationBuilder<APP,BUILDER>>C - the type of Document that is to be usedtype - the class of the type of Document that is to be usedname - the fully qualified name of the Document.consumer - the consumer to applypublic <C extends com.speedment.runtime.config.Document & com.speedment.runtime.config.trait.HasEnabled> BUILDER with(Class<C> type, BiConsumer<com.speedment.common.injector.Injector,C> consumer)
ApplicationBuilderDocument of a certain class. The
consumer will then be applied after the configuration has been read and
after the System properties have been applied.with in interface ApplicationBuilder<APP extends Speedment,BUILDER extends AbstractApplicationBuilder<APP,BUILDER>>C - the type of Document that is to be usedtype - the class of the type of Document that is to be usedconsumer - the consumer to applypublic <C extends com.speedment.runtime.config.Document & com.speedment.runtime.config.trait.HasEnabled> BUILDER with(Class<C> type, Consumer<C> consumer)
ApplicationBuilderDocument of a certain class. The
consumer will then be applied after the configuration has been read and
after the System properties have been applied.with in interface ApplicationBuilder<APP extends Speedment,BUILDER extends AbstractApplicationBuilder<APP,BUILDER>>C - the type of Document that is to be usedtype - the class of the type of Document that is to be usedconsumer - the consumer to applypublic BUILDER withParam(String key, String value)
ApplicationBuilderwithParam in interface ApplicationBuilder<APP extends Speedment,BUILDER extends AbstractApplicationBuilder<APP,BUILDER>>key - the key to setvalue - the new valuepublic BUILDER withPassword(char[] password)
ApplicationBuilderThis will not be saved in any configuration files!
withPassword in interface ApplicationBuilder<APP extends Speedment,BUILDER extends AbstractApplicationBuilder<APP,BUILDER>>password - to use for all dbms:es in this projectpublic BUILDER withPassword(String dbmsName, char[] password)
ApplicationBuilderThis will not be saved in any configuration files!
withPassword in interface ApplicationBuilder<APP extends Speedment,BUILDER extends AbstractApplicationBuilder<APP,BUILDER>>dbmsName - the name of the dbmspassword - to use for the named dbmspublic BUILDER withPassword(String password)
ApplicationBuilderThis will not be saved in any configuration files!
withPassword in interface ApplicationBuilder<APP extends Speedment,BUILDER extends AbstractApplicationBuilder<APP,BUILDER>>password - to use for all dbms:es in this projectpublic BUILDER withPassword(String dbmsName, String password)
ApplicationBuilderThis will not be saved in any configuration files!
withPassword in interface ApplicationBuilder<APP extends Speedment,BUILDER extends AbstractApplicationBuilder<APP,BUILDER>>dbmsName - the name of the dbmspassword - to use for the named dbmspublic BUILDER withUsername(String username)
ApplicationBuilderwithUsername in interface ApplicationBuilder<APP extends Speedment,BUILDER extends AbstractApplicationBuilder<APP,BUILDER>>username - to use for all dbms:es in this projectpublic BUILDER withUsername(String dbmsName, String username)
ApplicationBuilderwithUsername in interface ApplicationBuilder<APP extends Speedment,BUILDER extends AbstractApplicationBuilder<APP,BUILDER>>dbmsName - the name of the dbmsusername - to use for the named dbmspublic BUILDER withIpAddress(String ipAddress)
ApplicationBuilderwithIpAddress in interface ApplicationBuilder<APP extends Speedment,BUILDER extends AbstractApplicationBuilder<APP,BUILDER>>ipAddress - to use for all dbms:es in this projectpublic BUILDER withIpAddress(String dbmsName, String ipAddress)
ApplicationBuilderwithIpAddress in interface ApplicationBuilder<APP extends Speedment,BUILDER extends AbstractApplicationBuilder<APP,BUILDER>>dbmsName - the name of the dbmsipAddress - to use for the named dbms.public BUILDER withPort(int port)
ApplicationBuilderwithPort in interface ApplicationBuilder<APP extends Speedment,BUILDER extends AbstractApplicationBuilder<APP,BUILDER>>port - to use for all dbms:es in this projectpublic BUILDER withPort(String dbmsName, int port)
ApplicationBuilderwithPort in interface ApplicationBuilder<APP extends Speedment,BUILDER extends AbstractApplicationBuilder<APP,BUILDER>>dbmsName - the name of the dbmsport - to use for the named dbmspublic BUILDER withSchema(String schemaName)
ApplicationBuilderThis method is useful for multi-tenant projects where there are several identical schemas separated only by their names.
withSchema in interface ApplicationBuilder<APP extends Speedment,BUILDER extends AbstractApplicationBuilder<APP,BUILDER>>schemaName - to use for all schemas this projectpublic BUILDER withSchema(String oldSchemaName, String schemaName)
ApplicationBuilderThis method is useful for multi-tenant projects where there are several identical schemas separated only by their names.
withSchema in interface ApplicationBuilder<APP extends Speedment,BUILDER extends AbstractApplicationBuilder<APP,BUILDER>>oldSchemaName - the current name of a schemaschemaName - to use for the named schemapublic BUILDER withConnectionUrl(String connectionUrl)
ApplicationBuildernull, the connection URL will be calculated using the
dbmses' default connection URL generator (e.g. using ipAddress, port,
etc).
withConnectionUrl in interface ApplicationBuilder<APP extends Speedment,BUILDER extends AbstractApplicationBuilder<APP,BUILDER>>connectionUrl - to use for all dbms this project or nullpublic BUILDER withConnectionUrl(String dbmsName, String connectionUrl)
ApplicationBuildernull, the connection URL will be calculated using the
dbmses' default connection URL generator (e.g. using ipAddress, port,
etc).withConnectionUrl in interface ApplicationBuilder<APP extends Speedment,BUILDER extends AbstractApplicationBuilder<APP,BUILDER>>dbmsName - the name of the dbmsconnectionUrl - to use for the named dbms or nullpublic <M extends Manager<?>> BUILDER withManager(Class<M> managerImplType)
ApplicationBuilderwithManager in interface ApplicationBuilder<APP extends Speedment,BUILDER extends AbstractApplicationBuilder<APP,BUILDER>>M - the manager typemanagerImplType - the manager implementation classpublic BUILDER withSkipCheckDatabaseConnectivity()
ApplicationBuilderwithSkipCheckDatabaseConnectivity in interface ApplicationBuilder<APP extends Speedment,BUILDER extends AbstractApplicationBuilder<APP,BUILDER>>public BUILDER withSkipValidateRuntimeConfig()
ApplicationBuilderwithSkipValidateRuntimeConfig in interface ApplicationBuilder<APP extends Speedment,BUILDER extends AbstractApplicationBuilder<APP,BUILDER>>public BUILDER withSkipLogoPrintout()
ApplicationBuilderwithSkipLogoPrintout in interface ApplicationBuilder<APP extends Speedment,BUILDER extends AbstractApplicationBuilder<APP,BUILDER>>public BUILDER withBundle(Class<? extends com.speedment.common.injector.InjectBundle> bundleClass)
ApplicationBuilder
The specified classes will be instantiated using its default constructor
and fields annotated with Inject will be dependency injected.
Methods annotated with ExecuteBefore will also be executed as
part of the application configuration phase.
Note: If a class in the InjectBundle is specifying the same
InjectKey as an existing class previously added to this
ApplicationBuilder, then the last class will be associated with that
InjectKey. Thus, the order of calls to this method is
significant.
withBundle in interface ApplicationBuilder<APP extends Speedment,BUILDER extends AbstractApplicationBuilder<APP,BUILDER>>bundleClass - to use when adding injectablespublic BUILDER withComponent(Class<?> injectableClass)
ApplicationBuilderInject will be dependency injected. Methods annotated with
ExecuteBefore will also be executed as part of the application
configuration phase.
Note: If a component class is specifying the same InjectKey as
an existing class previously added to this ApplicationBuilder, then the
last class will be associated with that InjectKey. Thus, the
order of calls to ApplicationBuilder.withComponent(java.lang.Class) and
ApplicationBuilder.withBundle(java.lang.Class) is significant.
withComponent in interface ApplicationBuilder<APP extends Speedment,BUILDER extends AbstractApplicationBuilder<APP,BUILDER>>injectableClass - the implementation classpublic BUILDER withLogging(ApplicationBuilder.HasLoggerName namer)
ApplicationBuilderLogType.withLogging in interface ApplicationBuilder<APP extends Speedment,BUILDER extends AbstractApplicationBuilder<APP,BUILDER>>namer - logger with the namer to turn onfor standard
implementationpublic BUILDER withAllowStreamIteratorAndSpliterator()
ApplicationBuilderBaseStream.iterator() and
BaseStream.spliterator() terminating operations to
be called on Speedment streams.
Note: if enabled, make sure to close the Stream or else database connections will be consumed.
try (Stream<User> userStream = users.stream()) {
Iterator<User> userIterator = userStream();
// Do something with the Iterator
}
// The stream is auto-closed and the connection (if any) is returned.
withAllowStreamIteratorAndSpliterator in interface ApplicationBuilder<APP extends Speedment,BUILDER extends AbstractApplicationBuilder<APP,BUILDER>>public final APP build()
ApplicationBuilderbuild in interface ApplicationBuilder<APP extends Speedment,BUILDER extends AbstractApplicationBuilder<APP,BUILDER>>protected abstract APP build(com.speedment.common.injector.Injector injector)
injector - the injector to useprotected void validateRuntimeConfig(com.speedment.common.injector.Injector injector)
protected void checkDatabaseConnectivity(com.speedment.common.injector.Injector injector)
protected void printWelcomeMessage(com.speedment.common.injector.Injector injector)
injector - the injector to useCopyright © 2019 Speedment, Inc.. All rights reserved.