Class AuthControllerBuilder
java.lang.Object
ai.tutor.cab302exceptionalhandlers.builders.ControllerBuilder<AuthController>
ai.tutor.cab302exceptionalhandlers.builders.AuthControllerBuilder
Builder for creating instances of
AuthController
.
This class constructs either a LoginController
or a SignUpController
based on the specified AuthType
.
Usage Example:
AuthController controller = controllerFactory.authController() .type(AuthType.LOGIN) // or AuthType.SIGNUP .build();
- Author:
- Justin.
- See Also:
-
Field Summary
Fields inherited from class ai.tutor.cab302exceptionalhandlers.builders.ControllerBuilder
db
-
Constructor Summary
ConstructorsConstructorDescriptionConstructs anAuthControllerBuilder
. -
Method Summary
Modifier and TypeMethodDescriptionbuild()
Builds anAuthController
(eitherLoginController
orSignUpController
) based on the specifiedAuthType
.Builds aLoginController
.Builds aSignUpController
.Sets the type of authentication controller to build (LOGIN or SIGNUP).
-
Constructor Details
-
AuthControllerBuilder
Constructs anAuthControllerBuilder
.- Parameters:
db
- TheSQLiteConnection
to be used for database operations.- See Also:
-
-
Method Details
-
type
Sets the type of authentication controller to build (LOGIN or SIGNUP).- Parameters:
type
- TheAuthType
specifying the controller type.- Returns:
- This
AuthControllerBuilder
instance for chaining.
-
build
Builds anAuthController
(eitherLoginController
orSignUpController
) based on the specifiedAuthType
.- Specified by:
build
in classControllerBuilder<AuthController>
- Returns:
- An instance of
AuthController
. - Throws:
IllegalStateException
- if the authentication type is not set.RuntimeException
- if a database connection error occurs during controller construction.SQLException
- if a database access error occurs during controller construction.
-
buildLogin
Builds aLoginController
.- Returns:
- A new instance of
LoginController
. - Throws:
RuntimeException
- if a database connection error occurs.SQLException
- if a database access error occurs.
-
buildSignUp
Builds aSignUpController
.- Returns:
- A new instance of
SignUpController
. - Throws:
RuntimeException
- if a database connection error occurs.SQLException
- if a database access error occurs.
-