TeszCoreApi
| Β | Β |
|---|---|
| Type | π΅ Class |
| Package | io.github.mrtesz.teszcore.api |
| GitHub | TeszCoreApi.java |
| Implements | Copyable<TeszCoreApi> |
| Subclasses | TeszCoreApi.Initializer |
Description
The API class of the project
Initializing
To initialize the API you have to execute TeszCoreApi#initialize with a TeszCoreApi.Initializer instance
Methods
initialize
static TeszCoreApi initialize(TeszCoreInitializer teszCoreInitializer) throws DuplicateInitializationException, IllegalArgumentException;
Initialize the TeszCoreApi
| Parameter | Type | Annotations | Description |
|---|---|---|---|
teszCoreInitializer | TeszCoreInitializer | Β | The options the API will initialize with |
Returns: TeszCoreApi β the new TeszCoreApi instance (you can also get this through TeszCoreApi#getInstance())
Throws: DuplicateInitializationException when a TeszCoreApi instance was already initialized (can be bypassed with option TeszCoreInitializer#overwrite on true) Throws: IllegalArgumentException when the TeszCoreApi.Initializer.InitializerBuilder#loggerFilePath is not null and doesnβt end with a β/β
getInstance
static TeszCoreApi getInstance();
Get the last initialized TeszCoreApi instance
Returns: TeszCoreApi β the last initialized TeszCoreApi instance
Throws: NullPointerException if no instance was initialized before with TeszCoreApi#initialize
logException
void logException(@NotNull Throwable throwable);
Logs a throwable by calling TeszCoreLogger#printStackTrace
| Parameter | Type | Annotations | Description |
|---|---|---|---|
throwable | Throwable | @NotNull | The throwable to log |
getLogger
TeszCoreLogger getLogger(@NotNull DebugLevel debugLevel);
TeszCoreLogger getLogger(@NotNull DebugLevel debugLevel, @Nullable String projectName);
Get a TeszCoreLogger
| Parameter | Type | Annotations | Description |
|---|---|---|---|
debugLevel | DebugLevel | @NotNull | The level to send messages at |
projectName | String | @Nullable | (optional) The name of the project, using the logger |
Returns: TeszCoreLogger β a TeszCoreLogger to use for logging
createMariaDBManager
MariaDBManager createMariaDBManager(@Nullable String projectName, boolean infoWhenCredentialsAreNull, @Nullable String name, @Nullable String url, @Nullable String user, @Nullable String password);
Create a MariaDBManager
| Parameter | Type | Annotations | Description |
|---|---|---|---|
projectName | String | @Nullable | The name of the project, using the manager |
infoWhenCredentialsAreNull | boolean | Β | If connect() should throw a NullPointerException if url, user or passwort are null or blank |
name | String | @Nullable | The name of the database manager |
url | String | @Nullable | The url database, connecting to |
user | String | @Nullable | The username of the user, connecting with |
password | String | @Nullable | The password of the user, connecting with |
Returns: MariaDBManager β a MariaDBManager
createSqliteManager
SqliteManager createSqliteManager(@Nullable String projectName, @Nullable String path, @NotNull String name);
Create a SqliteManager
| Parameter | Type | Annotations | Description |
|---|---|---|---|
projectName | String | @Nullable | The name of the project, using the manager |
path | String | @Nullable | The path, the .db file β null uses the default location |
name | String | @NotNull | The name of the .db file |
Returns: SqliteManager β a SqliteManager
getLog4jLogger
Logger getLog4jLogger();
Get the org.apache.logging.log4j.Logger, TeszCore uses internally
Returns: Logger β the log4j logger, TeszCore uses internally
getInitializedWith
TeszCoreApi.TeszCoreInitializer getInitializedWith();
Get the TeszCoreApi.TeszCoreInitializer, the API was latest initialized with
Returns: Logger β the log4j logger, TeszCore uses internally
copy
implemented from Copyable
TeszCoreApi copy() throws DuplicatInitializationException, IllegalArgumentException;
Initialize a copy of the current TeszCoreApi by executing initialize(TeszCoreInitializer) with initializedWith
Returns: See initialize(TeszCoreInitializer)
Throws: See initialize(TeszCoreInitializer)