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

Android annotations ordering #8

Open
brunodles opened this issue Aug 21, 2018 · 0 comments
Open

Android annotations ordering #8

brunodles opened this issue Aug 21, 2018 · 0 comments
Labels
bug Something isn't working

Comments

@brunodles
Copy link
Owner

Android sorts the annotation by full annotation name, ignoring the declared order.

When we call something like this:

    @Selector("title")
    @TextCollector
    @Regexp("^(?:.*)\\s+?(\\d++)")
    @ToInt
    fun number(): Int = 1

It returns a list like this:

    @brunodles.animewatcher.ToInt()
    @com.brunodles.alchemist.collectors.TextCollector()
    @com.brunodles.alchemist.regex.Regex(value=^(?:.*)\s+?(\d++))
    @com.brunodles.alchemist.selector.Selector(value=title)

May we can use some prioritization to build the chain:

1_ look for selectors
2_ look for collectors
3_ look for transformer

But this will be harder to figure out, because it may lead to errors when we use transformers with same prioritization.

May we build proxies on compile time.

Since java does not change the annotations order we may build implementation classes for each interface with alchemist annotations.
When user calls the alchemist it will look for a concrete class that implements the declared methods of the interface.

@brunodles brunodles added the bug Something isn't working label Aug 21, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant