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 Groovy DSL #23

Merged
merged 4 commits into from
Sep 2, 2019
Merged

Add Groovy DSL #23

merged 4 commits into from
Sep 2, 2019

Conversation

jamierocks
Copy link
Member

@jamierocks jamierocks commented Sep 2, 2019

def EXTRA = new ExtensionKey(String, 'extra')

def mappings = MappingSetDsl.create {
    klass('a') {
        deobf = 'Demo'
        extension EXTRA, 'demo data'
        
        field('g') { deobf = 'name' }
        
        method('h', '(Z)Ljava/lang/String;') {
            deobf = 'getName'
            
            param(0) { deobf = 'example' }
        }
    }
}

For future reference:
This was written in Java, as it makes types easier, and the produced bytecode is much cleaner and efficient.

For historical value, https://gist.github.com/jamierocks/169d03318b8783df1b9a65d81bfbd5e5 is the beginnings of how the Groovy version would have turned out.

@jamierocks jamierocks mentioned this pull request Sep 2, 2019
@jamierocks jamierocks merged commit b506ea6 into develop Sep 2, 2019
@jamierocks jamierocks deleted the feature/dsl-groovy branch May 26, 2020 13:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Development

Successfully merging this pull request may close these issues.

None yet

1 participant