Method chaining for resources [Java SDK]