square / mortar

A simple library that makes it easy to pair thin views with dedicated controllers, isolated from most of the vagaries of the Activity life cycle.
Apache License 2.0
2.16k stars 156 forks source link

These isn't a public api to get the parent of a MortarScope. #197

Open fengdai opened 7 years ago

fengdai commented 7 years ago

Is it designed to be so? And how can I get the parent of a MortarScope?

rjrjr commented 7 years ago

Yeah, we should probably add that. We've been hesitant to do so because the "only" uses we've found have been for debugging output, and it seems more prone for abuse in production code.

In the meantime you can hack around the lack by introducing your own peekaboo class in the mortar package. E.g.

package mortar;

public class ScopeSpy {
  public static MortarScope parentScope(MortarScope mortarScope) {
    return mortarScope.parent;
  }
}