Skip to content

Instantly share code, notes, and snippets.

@lucperkins
Last active August 29, 2015 14:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lucperkins/8551d59e2cdbf14ab638 to your computer and use it in GitHub Desktop.
Save lucperkins/8551d59e2cdbf14ab638 to your computer and use it in GitHub Desktop.
public class Foo {
String word;
public Foo(String word) {
this.word = word;
}
}
public class FooUpdate extends Update<Foo> {
private Foo newFoo;
public FooUpdate(Foo newFoo) {
this.newFoo = newFoo;
}
public Foo update() {
return this.newFoo;
}
@Override
public T apply(Foo original) {
return update();
}
}
// Current value at the key: {"word":"old_word"}
UpdateValue update = new UpdateValue.Builder(location)
.withUpdate(new FooUpdate(new Foo("new word"))
.build();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment