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 enumerations support for JSObjects #53

Open
ccadete opened this issue Jan 26, 2015 · 1 comment
Open

Add enumerations support for JSObjects #53

ccadete opened this issue Jan 26, 2015 · 1 comment
Assignees

Comments

@ccadete
Copy link

ccadete commented Jan 26, 2015

When a JSObject interface method returns an enumeration of values, could they be translated directly to an enum, instead of an int or string?
First example: If the enumeration implements an interface the value could be retrieved, example:

public enum State implements JSEnum<String> {
    OPEN("open"),
    CLOSE("close")

    // ...

    @Override
    public String getValue(){
        ....
    }
}

Second example: Using custom annotation on the enum field:

public enum State implements JSObject {
    @JSEnumString("open")
    OPEN,

    @JSEnumString("close")
    CLOSE
}
@konsoletyper
Copy link
Owner

Yes, I thought about it, and this feature is even in roadmap in my head. Of course, annotations is the preferred way.

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

No branches or pull requests

2 participants