AST Transformations

How to write less code


Hi, I'm Maciej


BOILERPLATE


LAZY, But...

MenuItemActivity.intent(this)
.place(currentPlace)
.item(selectedItem)
.start();



HOW?


    ANNOTATION PROCESSING API


    BYTECODE WEAVING


    AST TRANSFORMATIONS


    LOMBOK + HRISEY


    MAGIC?

     public final class LoginActivity extends Activity {

    @MagicViews
    @Override
    protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState); setContentView(R.layout.login_activity);
    usernameField.setText(prefs.getUsername());
    }

    private void onSignInButtonClick() {
    String username = usernameField.getText().toString();
    String password = passwordField.getText().toString();
    // make API call
    }
    }


    TALK IS CHEAP,

    SHOW ME THE CODE


    GROOVY

    and more coding...


    Q || A


    THANKS!

    Now code only what is worth coding!


    LINKS

    AST Transformations / Droidcon London 2014

    By Maciej Górski

    AST Transformations / Droidcon London 2014

    • 3,231