Releases: MayconCardoso/ArchitectureBoilerplateGenerator
Releases · MayconCardoso/ArchitectureBoilerplateGenerator
3.0.0
2.0.0
Entity attributes
// Add fields on entity
addEntityField(Parameter(
name = "id", type = Type.Long
))
addEntityField(Parameter(
name = "name", type = Type.String
))
addEntityField(Parameter(
name = "anotherFeature", type = Type.CustomType(
packageValue = "com.mctech.architecture.domain.feature_empty.entity",
typeReturn = "FeatureEmpty"
)
))
Use Interaction
addUserInteraction {
UserInteractionBuilder(
name = "LoadList",
connectedState = findStateByName("listEntities"),
connectedUseCase = findUseCaseByName("LoadAllItemsCase")
)
}
addUserInteraction {
UserInteractionBuilder(
name = "OpenDetails",
parameters = listOf(
Parameter(
name = "item",
type = Type.GeneratedEntity
),
Parameter(
name = "simpleList",
type = Type.CustomType(
packageValue = "com.mctech.architecture.domain.feature_empty.entity",
typeReturn = "FeatureEmpty"
)
)
),
connectedState = findStateByName("itemDetails"),
connectedUseCase = findUseCaseByName("LoadItemDetailCase")
)
}
Generated Code
- UserInteraction Class
sealed class ComplexFeatureUserInteraction: UserInteraction{
object LoadList : ComplexFeatureUserInteraction()
data class OpenDetails(
val item : ComplexFeature,
val simpleList : FeatureEmpty
) : ComplexFeatureUserInteraction()
}
- ViewModel Methods
@OnInteraction(ComplexFeatureUserInteraction.LoadList::class)
private suspend fun loadListInteraction(){
_listEntities.changeToListLoadingState()
when(val result = loadAllItemsCase.execute()){
is Result.Success -> {
_listEntities.changeToSuccessState(result.result)
}
is Result.Failure -> {
_listEntities.changeToErrorState(result.throwable)
}
}
}
@OnInteraction(ComplexFeatureUserInteraction.OpenDetails::class)
private suspend fun openDetailsInteraction(interaction : ComplexFeatureUserInteraction.OpenDetails){
_itemDetails.changeToLoadingState()
when(val result = loadItemDetailCase.execute(interaction.item, interaction.simpleList)){
is Result.Success -> {
_itemDetails.changeToSuccessState(result.result)
}
is Result.Failure -> {
_itemDetails.changeToErrorState(result.throwable)
}
}
}
1.1.4
- Multiple features (1.1.4)
1.1.0
- Feature ignore (1.1.0)
1.0.1
v1.0.1 - Organizing project
1.0.0
The initial version of the library