Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add LabelInterfaces #16

Open
programmerr47 opened this issue Aug 23, 2017 · 0 comments
Open

Add LabelInterfaces #16

programmerr47 opened this issue Aug 23, 2017 · 0 comments

Comments

@programmerr47
Copy link
Owner

In case when we have an action method in Category Interface with enumeration of labels, we need to create special enum for it, if there are no other options. I think, it will be better to provide special LabelInterface. So for example, this:

interface AnalyticsPerson {
    fun live(type: LiveTypeLabel)
}

enum class LiveTypeLabel { FLAT, HOUSE, APARTMENT }

will be converted to this:

interface AnalyticsPerson {
    fun live(): LiveLabel
}

interface LiveLabel {
    fun flat()
    fun house()
    fun apartment()
}

So the invocation of it will look like:
analyticsPerson.live().flat() instead of analyticsPerson.live(FLAT)

Moreover it can help to decrease number of duplication since there could be several action methods with same enum params, and when they will be used we can totally replace one invocation with another.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant