addAlias<P, C extends P> method

void addAlias<P, C extends P>()
inherited

子类可以转化成父类

Implementation

void addAlias<P, C extends P>() {
  assert(!_factorys.containsKey(P) || Log.e('$P already exists.'));
  _alias[P] = C; // 可以根据父类类型获取到子类对象
}