APP
- application that is builtBUILDER
- the type of this builderpublic interface ApplicationBuilder<APP extends Speedment,BUILDER extends ApplicationBuilder<APP,BUILDER>>
Speedment
instances.Modifier and Type | Interface and Description |
---|---|
static interface |
ApplicationBuilder.HasLoggerName
Interface used for getting logger names.
|
static class |
ApplicationBuilder.LogType
The type of logging to change the settings for.
|
Modifier and Type | Method and Description |
---|---|
APP |
build()
Builds this application.
|
<C extends Document & 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 Document & HasEnabled> |
with(Class<C> type,
Consumer<C> consumer)
Configures a parameter for all
Document of a certain class. |
<C extends Document & 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. |
default <C extends Document & HasEnabled> |
with(Class<C> type,
String name,
Consumer<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.
|
default <I extends HasDbmsId & HasSchemaId & HasTableId & HasColumnId> |
withColumn(I id,
BiConsumer<com.speedment.common.injector.Injector,Column> consumer)
Configures a parameter for the identified column.
|
default <I extends HasDbmsId & HasSchemaId & HasTableId & HasColumnId> |
withColumn(I id,
Consumer<Column> consumer)
Configures a parameter for the identified table.
|
BUILDER |
withComponent(Class<?> componentClass)
Adds a custom component implementation class.
|
default <I extends HasDbmsId> |
withConnectionUrl(I id,
String connectionUrl)
Configures a connection URL for the identified dbms.
|
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.
|
default <I extends HasDbmsId> |
withDbms(I identifier,
BiConsumer<com.speedment.common.injector.Injector,Dbms> consumer)
Configures a parameter for the identified dbms.
|
default <I extends HasDbmsId> |
withDbms(I id,
Consumer<Dbms> consumer)
Configures a parameter for the identified dbms.
|
default <I extends HasDbmsId> |
withIpAddress(I id,
String ipAddress)
Configures an IP Address for the identified dbms.
|
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.
|
default <I extends HasDbmsId> |
withPassword(I id,
char[] password)
Configures a password for the identified dbms.
|
default <I extends HasDbmsId> |
withPassword(I id,
String password)
Configures a password for the identified dbms.
|
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.
|
default <I extends HasDbmsId> |
withPort(I id,
int port)
Configures a port for the identified 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.
|
default <I extends HasDbmsId & HasSchemaId> |
withSchema(I identifier,
BiConsumer<com.speedment.common.injector.Injector,Schema> consumer)
Configures a parameter for the identified schema.
|
default <I extends HasDbmsId & HasSchemaId> |
withSchema(I id,
Consumer<Schema> consumer)
Configures a parameter for the identified schema.
|
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().
|
default <I extends HasDbmsId & HasSchemaId & HasTableId> |
withTable(I identifier,
BiConsumer<com.speedment.common.injector.Injector,Table> consumer)
Configures a parameter for the identified table.
|
default <I extends HasDbmsId & HasSchemaId & HasTableId> |
withTable(I id,
Consumer<Table> consumer)
Configures a parameter for the identified table.
|
default <I extends HasDbmsId> |
withUsername(I id,
String username)
Configures a username for the identified dbms.
|
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.
|
default <I extends HasDbmsId> BUILDER withDbms(I id, Consumer<Dbms> consumer)
I
- the identifier typeid
- of the dbmsconsumer
- the consumer to applydefault <I extends HasDbmsId> BUILDER withDbms(I identifier, BiConsumer<com.speedment.common.injector.Injector,Dbms> consumer)
I
- the identifier typeidentifier
- of the dbmsconsumer
- the consumer to applydefault <I extends HasDbmsId & HasSchemaId> BUILDER withSchema(I id, Consumer<Schema> consumer)
I
- the identifier typeid
- of the schemaconsumer
- the consumer to applydefault <I extends HasDbmsId & HasSchemaId> BUILDER withSchema(I identifier, BiConsumer<com.speedment.common.injector.Injector,Schema> consumer)
I
- the identifier typeidentifier
- of the schemaconsumer
- the consumer to applydefault <I extends HasDbmsId & HasSchemaId & HasTableId> BUILDER withTable(I id, Consumer<Table> consumer)
I
- the identifier typeid
- of the tableconsumer
- the consumer to applydefault <I extends HasDbmsId & HasSchemaId & HasTableId> BUILDER withTable(I identifier, BiConsumer<com.speedment.common.injector.Injector,Table> consumer)
I
- the identifier typeidentifier
- of the tableconsumer
- the consumer to applydefault <I extends HasDbmsId & HasSchemaId & HasTableId & HasColumnId> BUILDER withColumn(I id, Consumer<Column> consumer)
I
- the identifier typeid
- of the columnconsumer
- the consumer to applydefault <I extends HasDbmsId & HasSchemaId & HasTableId & HasColumnId> BUILDER withColumn(I id, BiConsumer<com.speedment.common.injector.Injector,Column> consumer)
I
- the identifier typeid
- of the columnconsumer
- the consumer to applydefault <C extends Document & HasEnabled> BUILDER with(Class<C> type, String name, Consumer<C> consumer)
Document
of a certain class.
The consumer will then be applied after the configuration has been read
and after the System properties have been applied.<C extends Document & HasEnabled> BUILDER with(Class<C> type, String name, BiConsumer<com.speedment.common.injector.Injector,C> consumer)
Document
of a certain class.
The consumer will then be applied after the configuration has been read
and after the System properties have been applied.<C extends Document & HasEnabled> BUILDER with(Class<C> type, Consumer<C> consumer)
Document
of a certain class. The
consumer will then be applied after the configuration has been read and
after the System properties have been applied.<C extends Document & HasEnabled> BUILDER with(Class<C> type, BiConsumer<com.speedment.common.injector.Injector,C> consumer)
Document
of a certain class. The
consumer will then be applied after the configuration has been read and
after the System properties have been applied.BUILDER withParam(String key, String value)
key
- the key to setvalue
- the new valueBUILDER withPassword(char[] password)
This will not be saved in any configuration files!
password
- to use for all dbms:es in this projectBUILDER withPassword(String dbmsName, char[] password)
This will not be saved in any configuration files!
dbmsName
- the name of the dbmspassword
- to use for the named dbmsdefault <I extends HasDbmsId> BUILDER withPassword(I id, char[] password)
This will not be saved in any configuration files!
I
- identification typeid
- the identification of the dbmspassword
- to use for the identified dbmsBUILDER withPassword(String password)
This will not be saved in any configuration files!
password
- to use for all dbms:es in this projectBUILDER withPassword(String dbmsName, String password)
This will not be saved in any configuration files!
dbmsName
- the name of the dbmspassword
- to use for the named dbmsdefault <I extends HasDbmsId> BUILDER withPassword(I id, String password)
This will not be saved in any configuration files!
I
- identification typeid
- the identification of the dbmspassword
- to use for the identified dbmsBUILDER withUsername(String username)
username
- to use for all dbms:es in this projectBUILDER withUsername(String dbmsName, String username)
dbmsName
- the name of the dbmsusername
- to use for the named dbmsdefault <I extends HasDbmsId> BUILDER withUsername(I id, String username)
This will not be saved in any configuration files!
I
- identification typeid
- the identification of the dbmsusername
- to use for the identified dbmsBUILDER withIpAddress(String ipAddress)
ipAddress
- to use for all dbms:es in this projectBUILDER withIpAddress(String dbmsName, String ipAddress)
dbmsName
- the name of the dbmsipAddress
- to use for the named dbms.default <I extends HasDbmsId> BUILDER withIpAddress(I id, String ipAddress)
This will not be saved in any configuration files!
I
- identification typeid
- the identification of the dbmsipAddress
- to use for the identified dbmsBUILDER withPort(int port)
port
- to use for all dbms:es in this projectBUILDER withPort(String dbmsName, int port)
dbmsName
- the name of the dbmsport
- to use for the named dbmsdefault <I extends HasDbmsId> BUILDER withPort(I id, int port)
This will not be saved in any configuration files!
I
- identification typeid
- the identification of the dbmsport
- to use for the identified dbmsBUILDER withSchema(String schemaName)
This method is useful for multi-tenant projects where there are several identical schemas separated only by their names.
schemaName
- to use for all schemas this projectBUILDER withSchema(String oldSchemaName, String schemaName)
This method is useful for multi-tenant projects where there are several identical schemas separated only by their names.
oldSchemaName
- the current name of a schemaschemaName
- to use for the named schemaBUILDER withConnectionUrl(String connectionUrl)
null
, the connection URL will be calculated using the
dbmses' default connection URL generator (e.g. using ipAddress, port,
etc).
connectionUrl
- to use for all dbms this project or nullBUILDER withConnectionUrl(String dbmsName, String connectionUrl)
null
, the connection URL will be calculated using the
dbmses' default connection URL generator (e.g. using ipAddress, port,
etc).dbmsName
- the name of the dbmsconnectionUrl
- to use for the named dbms or nulldefault <I extends HasDbmsId> BUILDER withConnectionUrl(I id, String connectionUrl)
This will not be saved in any configuration files!
I
- identification typeid
- the identification of the dbmsconnectionUrl
- to use for the identified dbmsBUILDER withSkipCheckDatabaseConnectivity()
BUILDER withSkipValidateRuntimeConfig()
BUILDER withSkipLogoPrintout()
<M extends Manager<?>> BUILDER withManager(Class<M> managerImplType)
M
- the manager typemanagerImplType
- the manager implementation classBUILDER withComponent(Class<?> componentClass)
Inject
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 withComponent(java.lang.Class)
and
withBundle(java.lang.Class)
is significant.
componentClass
- the implementation classBUILDER withBundle(Class<? extends com.speedment.common.injector.InjectBundle> bundleClass)
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.
bundleClass
- to use when adding injectablesBUILDER withLogging(ApplicationBuilder.HasLoggerName namer)
LogType
.namer
- logger with the namer to turn onfor standard
implementation
BUILDER withAllowStreamIteratorAndSpliterator()
BaseStream.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.
APP build()
Copyright © 2018 Speedment, Inc.. All rights reserved.