/** * Sets the context. By default, it also updates the context of already registered services. * * @param context The context. */ public void setContext(Context context) { this.context = context; for (Service service : this) { service.setContext(context); } }
@Override public boolean addAll(int index, Collection<? extends Service> services) { if (services != null) { for (Service service : services) { service.setContext(getContext()); } } return super.addAll(index, services); }
@Override public boolean add(Service service) { service.setContext(getContext()); return super.add(service); }
@Override public void add(int index, Service service) { service.setContext(getContext()); super.add(index, service); }