Creates a {@link AndroidLifecycleScopeProvider} for Android Lifecycles.

@param lifecycle the lifecycle to scope for.
@param untilEvent the event until the scope is valid.
@return a {@link AndroidLifecycleScopeProvider} against this lifecycle.
428040
public static AndroidLifecycleScopeProvider from(
      Lifecycle lifecycle, Lifecycle.Event untilEvent) {
    return from(lifecycle, new UntilEventFunction(untilEvent));
  }
681049
@SuppressWarnings( "unchecked" )
    private List<String> findOptionalMojosForLifecycle( MavenProject project, Lifecycle lifecycle )
        throws LifecycleExecutionException, PluginNotFoundException
    {
        String packaging = project.getPackaging();
        List<String> optionalMojos = null;

        LifecycleMapping m =
            (LifecycleMapping) findExtension( project, LifecycleMapping.ROLE, packaging, session.getSettings(),
                                              session.getLocalRepository() );

        if ( m != null )
        {
            optionalMojos = m.getOptionalMojos( lifecycle.getId() );
        }

        if ( optionalMojos == null )
        {
            try
            {
                m = (LifecycleMapping) session.lookup( LifecycleMapping.ROLE, packaging );
                optionalMojos = m.getOptionalMojos( lifecycle.getId() );
            }
            catch ( ComponentLookupException e )
            {
                log.debug( "Error looking up lifecycle mapping to retrieve optional mojos. Lifecycle ID: "
                    + lifecycle.getId() + ". Error: " + e.getMessage(), e );
            }
        }

        if ( optionalMojos == null )
        {
            optionalMojos = Collections.emptyList();
        }

        return optionalMojos;
    }
113200
@Override
    protected void onCreate(Bundle savedInstanceState) {
        final RoboInjector injector = RoboGuice.getInjector(this);
        eventManager = injector.getInstance(EventManager.class);
        preferenceListener = injector.getInstance(PreferenceListener.class);
        injector.injectMembersWithoutViews(this);
        super.onCreate(savedInstanceState);
        eventManager.fire(new OnCreateEvent(savedInstanceState));
    }
574788
private static MutablePicoContainer createContainer(ComponentContainer parent) {
    ComponentMonitor componentMonitor = new NullComponentMonitor();
    ReflectionLifecycleStrategy lifecycleStrategy = new StopSafeReflectionLifecycleStrategy(componentMonitor) {
      @Override
      public boolean isLazy(ComponentAdapter<?> adapter) {
        return true;
      }
    };
    return new DefaultPicoContainer(new OptInCaching(), lifecycleStrategy, parent.getPicoContainer(), componentMonitor);
  }
436937
public B timerWithCycle(String timerCycle) {
    TimeCycle timeCycle = createInstance(TimeCycle.class);
    timeCycle.setTextContent(timerCycle);

    TimerEventDefinition timerEventDefinition = createInstance(TimerEventDefinition.class);
    timerEventDefinition.setTimeCycle(timeCycle);

    element.getEventDefinitions().add(timerEventDefinition);

    return myself;
  }
174569
public static SagaEnvironment create(
            final TimeoutManager timeoutManager,
            final StateStorage storage,
            final Provider<CurrentExecutionContext> contextProvider,
            final Set<SagaModule> modules,
            final Set<SagaLifetimeInterceptor> interceptors,
            final InstanceResolver sagaInstanceResolver,
            final ModuleCoordinatorFactory coordinatorFactory) {
        return new SagaEnvironment(timeoutManager, storage, contextProvider, modules, interceptors, sagaInstanceResolver, coordinatorFactory);
    }
627383
public ActivityImpl parseInclusiveGateway(Element inclusiveGwElement, ScopeImpl scope) {
    ActivityImpl activity = createActivityOnScope(inclusiveGwElement, scope);
    activity.setActivityBehavior(new InclusiveGatewayActivityBehavior());

    parseAsynchronousContinuationForActivity(inclusiveGwElement, activity);

    parseExecutionListenersOnScope(inclusiveGwElement, activity);

    for (BpmnParseListener parseListener : parseListeners) {
      parseListener.parseInclusiveGateway(inclusiveGwElement, scope, activity);
    }
    return activity;
  }
498581
public void setContextLifecycleListeners(
			Collection<? extends LifecycleListener> contextLifecycleListeners) {
		Assert.notNull(contextLifecycleListeners,
				"ContextLifecycleListeners must not be null");
		this.contextLifecycleListeners = new ArrayList<>(contextLifecycleListeners);
	}
48420
public static void registerActivityLifecycleCallbacks(Application application, ActivityLifecycleCallbacksCompat callback) {
        if (PRE_ICS) {
            preIcsRegisterActivityLifecycleCallbacks(callback);
        } else {
            postIcsRegisterActivityLifecycleCallbacks(application, callback);
        }
    }
635842
@Nullable
    @MainThread
    private static LifecycleOwner getLifecycleOwner(ViewDataBinding binding) {
        if (!fieldFaild && lifecycleOwnerField == null) {
            try {
                lifecycleOwnerField = ViewDataBinding.class.getDeclaredField("mLifecycleOwner");
                lifecycleOwnerField.setAccessible(true);
            } catch (NoSuchFieldException e) {
                fieldFaild = true;
                return null;
            }
        }
        if (lifecycleOwnerField == null) {
            return null;
        }
        try {
            return (LifecycleOwner) lifecycleOwnerField.get(binding);
        } catch (IllegalAccessException e) {
            return null;
        }
    }
105803
public void setOnCreate(java.util.Collection<NotebookInstanceLifecycleHook> onCreate) {
        if (onCreate == null) {
            this.onCreate = null;
            return;
        }

        this.onCreate = new java.util.ArrayList<NotebookInstanceLifecycleHook>(onCreate);
    }
281575
public ProxyDataSourceBuilder listener(JdbcLifecycleEventListener listener) {
        JdbcLifecycleEventExecutionListener executionListener = new JdbcLifecycleEventExecutionListener(listener);
        this.queryExecutionListeners.add(executionListener);
        this.methodExecutionListeners.add(executionListener);
        return this;
    }
1173258
public void processStartOfScope(Scope scopeStarting, Iterable<Object> handlerInstances) throws Exception {
        for (Object handler : handlerInstances) {
            Handler handlerAnnotation = handler.getClass().getAnnotation(Handler.class);
            Scope handlerScope = handlerAnnotation.scope();

            injectResourceFieldsForScope(scopeStarting, handler, handlerScope, handlerInstances);
            runLifecycleMethods(handler, handlerScope, scopeStarting, false);
        }    
    }
45913
public LifecycleListener createLifecycleListener() {
        return new LifecycleListener() {

            @Override
            public void onForegrounded(Context context) {
                synchronized (lock) {
                    if (!isForegrounded) {
                        isForegrounded = true;
                        connectSocket();
                        if (receiver == null) {
                            receiver = new InternetConnectionReceiver(socketConnection);
                        }
                        context.registerReceiver(receiver, new IntentFilter(ConnectivityManager.CONNECTIVITY_ACTION));
                    }
                    lock.notifyAll();
                }
            }

            @Override
            public void onBackgrounded(Context context) {
                synchronized (lock) {
                    if (isForegrounded) {
                        isForegrounded = false;
                        disconnectSocket();
                        if (receiver != null && !isForegrounded) {
                            context.unregisterReceiver(receiver);
                        }
                    }
                    lock.notifyAll();
                }
            }
        };
    }
1100911
public IScope createFeatureCallScope(EObject context, EReference reference, IFeatureScopeSession session, IResolvedTypes resolvedTypes) {
		if (!isFeatureCallScope(reference)) {
			throw new IllegalArgumentException(String.valueOf(reference));
		}
		if (!(context instanceof XAbstractFeatureCall)) {
			return IScope.NULLSCOPE;
		}
		XAbstractFeatureCall call = (XAbstractFeatureCall) context;
		final XExpression syntacticalReceiver = getSyntacticalReceiver(call);
		if (syntacticalReceiver == null) {
			IScope result = createSimpleFeatureCallScope(call, session, resolvedTypes);
			return result;
		}
		IScope result = createFeatureCallScopeForReceiver(call, syntacticalReceiver, session, resolvedTypes);
		return result;
	}
160219
private void runLifecycleMethods(Object handler, Scope scope, Scope targetMethodScope, boolean isDestroy) throws Exception {
        String description = isDestroy ? "@Destroy" : "@Initialize";
        log.debug("Running " + description + " methods for Handler " + handler);

        Class<?> handlerClass = handler.getClass();
        for (Method method : handlerClass.getMethods()) {   //getMethods() includes inherited methods
            if (method.getParameterTypes().length == 0) {

                Scope methodScope = getMethodScope(isDestroy, method);

                //if this lifecycle method is for the correct cope, then run it
                if (methodScope != null && methodScope == targetMethodScope) {
                    log.trace("Found " + description + " annotation with scope " + targetMethodScope + " on handler method " + method + " and will now invoke it");
                    try {
                        method.invoke(handler);
                    } catch ( Throwable t) {
                        log.warn("Exception when calling " + description + " method [" + method + "] with scope " + targetMethodScope + " on handler " + handlerClass, t);
                    }
                }
            }
        }
    }
192444
function until(emitter, eventName, handler, context) {
  handler = context ? handler.bind(context) : handler;
  let wrapper = function untilHandler(event) {
    if (handler(event))
      emitter.removeEventListener(eventName, untilHandler);
  };
  emitter.addEventListener(eventName, wrapper);
  return wrapper;
}