Skip to content

Instantly share code, notes, and snippets.

@tylertreat
Created December 31, 2014 21:24
Show Gist options
  • Select an option

  • Save tylertreat/4aa97ed1dffdb71ba5fd to your computer and use it in GitHub Desktop.

Select an option

Save tylertreat/4aa97ed1dffdb71ba5fd to your computer and use it in GitHub Desktop.
public class FooEntity {
enum Status { GHOST, LOADING, LOADED };
private Status status;
private long id;
private BarEntity relatedEntity;
public FooEntity(long id) {
this.id = id;
}
public BarEntity getRelatedEntity() {
if (status == Status.GHOST)
Datastore.load(this);
return relatedEntity;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment