Skip to content

Releases: MayconCardoso/ArchitectureBoilerplateGenerator

3.0.0

11 Apr 09:10
Compare
Choose a tag to compare

Moving from JCenter to Maven Center

2.0.0

20 May 22:11
Compare
Choose a tag to compare

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

28 Apr 22:08
Compare
Choose a tag to compare
- Multiple features (1.1.4)

1.1.0

28 Apr 19:24
Compare
Choose a tag to compare
- Feature ignore (1.1.0)

1.0.1

16 Dec 00:49
Compare
Choose a tag to compare
v1.0.1

- Organizing project

1.0.0

12 Dec 17:01
49dd4a9
Compare
Choose a tag to compare

The initial version of the library