Last active
August 29, 2015 14:06
-
-
Save lucperkins/8551d59e2cdbf14ab638 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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