Class SubPojoDefinition.SubPojoDefinitionBuilder
java.lang.Object
com.github.tadukoo.database.mysql.pojo.SubPojoDefinition.SubPojoDefinitionBuilder
- All Implemented Interfaces:
SubPojoDefinition.Build,SubPojoDefinition.IDColumn,SubPojoDefinition.Key,SubPojoDefinition.TypeAndJunction
- Enclosing class:
- SubPojoDefinition
public static class SubPojoDefinition.SubPojoDefinitionBuilder
extends Object
implements SubPojoDefinition.Key, SubPojoDefinition.IDColumn, SubPojoDefinition.TypeAndJunction, SubPojoDefinition.Build
A builder used to build a
SubPojoDefinition. It takes the following parameters:
| Parameter | Description | Default or Required |
|---|---|---|
| key | The key the sub pojo is stored using in the pojo | Required |
| idCol | The ID column for the sub pojo's ID stored in the pojo | Required if type or junction is specified, otherwise defaults to null |
| type | The class used for the sub pojo, in case the pojo has to create a new instance of it | Required if junction is specified, otherwise defaults to null |
| junction | The junction to use for this sub pojo when doing a search on the pojo | Required if type is specified, otherwise defaults to null |
- Version:
- Alpha v.0.3
- Author:
- Logan Ferree (Tadukoo)
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate StringThe ID column for the sub pojo's ID stored in the pojoThe junction to use for this sub pojo when doing a search on the pojoprivate StringThe key the sub pojo is stored using in the pojoprivate Class<? extends DatabasePojo>The class used for the sub pojo, in case the pojo has to create a new instance of it -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbuild()Builds a newSubPojoDefinitionusing the set parameters after checking for problemsprivate voidChecks for any errors in the set parameters and throws an error if any problems are foundtypeAndJunction(Class<? extends DatabasePojo> type, com.github.tadukoo.util.tuple.Pair<ColumnRef, ColumnRef> junction)
-
Field Details
-
key
The key the sub pojo is stored using in the pojo -
idCol
The ID column for the sub pojo's ID stored in the pojo -
type
The class used for the sub pojo, in case the pojo has to create a new instance of it -
junction
The junction to use for this sub pojo when doing a search on the pojo
-
-
Constructor Details
-
SubPojoDefinitionBuilder
private SubPojoDefinitionBuilder()Not allowed to instantiate outsideSubPojoDefinition
-
-
Method Details
-
key
- Specified by:
keyin interfaceSubPojoDefinition.Key- Parameters:
key- The key the sub pojo is stored using in the pojo- Returns:
- this, to continue building
-
idCol
- Specified by:
idColin interfaceSubPojoDefinition.IDColumn- Parameters:
idCol- The ID column for the sub pojo's ID stored in the pojo- Returns:
- this, to continue building
-
typeAndJunction
public SubPojoDefinition.Build typeAndJunction(Class<? extends DatabasePojo> type, com.github.tadukoo.util.tuple.Pair<ColumnRef, ColumnRef> junction) - Specified by:
typeAndJunctionin interfaceSubPojoDefinition.TypeAndJunction- Parameters:
type- The class used for the sub pojo, in case the pojo has to create a new instance of itjunction- The junction to use for this sub pojo when doing a search on the pojo- Returns:
- this, to continue building
-
checkForErrors
private void checkForErrors()Checks for any errors in the set parameters and throws an error if any problems are found -
build
Builds a newSubPojoDefinitionusing the set parameters after checking for problems- Specified by:
buildin interfaceSubPojoDefinition.Build- Returns:
- The newly built
SubPojoDefinition
-