/** * Returns true if this is the default scope. In this case a new instance will be provided for * each injection. */ public boolean isNoScope() { return getScopeInstance() == Scopes.NO_SCOPE; }
@Override public boolean equals(Object obj) { if (obj instanceof Scoping) { Scoping o = (Scoping) obj; return Objects.equal(getScopeAnnotation(), o.getScopeAnnotation()) && Objects.equal(getScopeInstance(), o.getScopeInstance()); } else { return false; } }
@Override public int hashCode() { return Objects.hashCode(getScopeAnnotation(), getScopeInstance()); }
/** Scopes an internal factory. */ static <T> InternalFactory<? extends T> scope( Key<T> key, InjectorImpl injector, InternalFactory<? extends T> creator, Object source, Scoping scoping) { if (scoping.isNoScope()) { return creator; } Scope scope = scoping.getScopeInstance(); // NOTE: SingletonScope relies on the fact that we are passing a // ProviderToInternalFactoryAdapter here. If you change the type make sure to update // SingletonScope as well. Provider<T> scoped = scope.scope(key, new ProviderToInternalFactoryAdapter<T>(injector, creator)); return new InternalFactoryToProviderAdapter<T>(scoped, source); }
/** * Returns true if this is the default scope. In this case a new instance will be provided for * each injection. */ public boolean isNoScope() { return getScopeInstance() == Scopes.NO_SCOPE; }
/** * Returns true if this is the default scope. In this case a new instance will be provided for * each injection. */ public boolean isNoScope() { return getScopeInstance() == Scopes.NO_SCOPE; }
/** * Returns true if this is the default scope. In this case a new instance will be provided for * each injection. */ public boolean isNoScope() { return getScopeInstance() == Scopes.NO_SCOPE; }
/** * Returns true if this is the default scope. In this case a new instance will be provided for * each injection. */ public boolean isNoScope() { return getScopeInstance() == Scopes.NO_SCOPE; }
/** * Returns true if this is the default scope. In this case a new instance will be provided for * each injection. */ public boolean isNoScope() { return getScopeInstance() == Scopes.NO_SCOPE; }
/** * Returns true if this is the default scope. In this case a new instance will be provided for * each injection. */ public boolean isNoScope() { return getScopeInstance() == Scopes.NO_SCOPE; }
@Override public boolean equals(Object obj) { if (obj instanceof Scoping) { Scoping o = (Scoping) obj; return Objects.equal(getScopeAnnotation(), o.getScopeAnnotation()) && Objects.equal(getScopeInstance(), o.getScopeInstance()); } else { return false; } }
@Override public boolean equals(Object obj) { if (obj instanceof Scoping) { Scoping o = (Scoping) obj; return Objects.equal(getScopeAnnotation(), o.getScopeAnnotation()) && Objects.equal(getScopeInstance(), o.getScopeInstance()); } else { return false; } }
@Override public boolean equals(Object obj) { if (obj instanceof Scoping) { Scoping o = (Scoping) obj; return Objects.equal(getScopeAnnotation(), o.getScopeAnnotation()) && Objects.equal(getScopeInstance(), o.getScopeInstance()); } else { return false; } }
@Override public boolean equals(Object obj) { if(obj instanceof Scoping) { Scoping o = (Scoping)obj; return Objects.equal(getScopeAnnotation(), o.getScopeAnnotation()) && Objects.equal(getScopeInstance(), o.getScopeInstance()); } else { return false; } }
@Override public boolean equals(Object obj) { if(obj instanceof Scoping) { Scoping o = (Scoping)obj; return Objects.equal(getScopeAnnotation(), o.getScopeAnnotation()) && Objects.equal(getScopeInstance(), o.getScopeInstance()); } else { return false; } }
@Override public boolean equals(Object obj) { if(obj instanceof Scoping) { Scoping o = (Scoping)obj; return Objects.equal(getScopeAnnotation(), o.getScopeAnnotation()) && Objects.equal(getScopeInstance(), o.getScopeInstance()); } else { return false; } }
@Override public int hashCode() { return Objects.hashCode(getScopeAnnotation(), getScopeInstance()); }
/** * Scopes an internal factory. */ static <T> InternalFactory<? extends T> scope(Key<T> key, InjectorImpl injector, InternalFactory<? extends T> creator, Object source, Scoping scoping) { if (scoping.isNoScope()) { return creator; } Scope scope = scoping.getScopeInstance(); Provider<T> scoped = scope.scope(key, new ProviderToInternalFactoryAdapter<T>(injector, creator)); return new InternalFactoryToProviderAdapter<T>(scoped, source); }
/** Scopes an internal factory. */ static <T> InternalFactory<? extends T> scope(Key<T> key, InjectorImpl injector, InternalFactory<? extends T> creator, Object source, Scoping scoping) { if (scoping.isNoScope()) { return creator; } Scope scope = scoping.getScopeInstance(); Provider<T> scoped = scope.scope(key, new ProviderToInternalFactoryAdapter<T>(injector, creator)); return new InternalFactoryToProviderAdapter<T>( Initializables.<Provider<? extends T>>of(scoped), source); }
/** Scopes an internal factory. */ static <T> InternalFactory<? extends T> scope(Key<T> key, InjectorImpl injector, InternalFactory<? extends T> creator, Object source, Scoping scoping) { if (scoping.isNoScope()) { return creator; } Scope scope = scoping.getScopeInstance(); Provider<T> scoped = scope.scope(key, new ProviderToInternalFactoryAdapter<T>(injector, creator)); return new InternalFactoryToProviderAdapter<T>( Initializables.<Provider<? extends T>>of(scoped), source); }