Skip to content

Instantly share code, notes, and snippets.

@tleyden
Last active December 31, 2015 19:09
Show Gist options
  • Save tleyden/8031420 to your computer and use it in GitHub Desktop.
Save tleyden/8031420 to your computer and use it in GitHub Desktop.
Person CouchbaseLite
class Person {
private Document document;
private Map<String, Object> properties;
public Person() {
this(getDatabaseSomehow().createDocument());
}
public Person(Document documentParam) {
document = documentParam;
properties = new HashMap<String, Object>();
properties.putAll(document.getProperties());
}
public void setName(String name) {
properties.put("name", name);
}
public void getName() {
document.getProperty("name");
}
public void save() throws CouchbaseLiteException {
document.putProperties(properties);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment