using System; using System.Collections.Generic; #if !NOT_UNITY3D using JetBrains.Annotations; #endif namespace Zenject { // Zero parameters public class PlaceholderFactory : PlaceholderFactoryBase, IFactory { // Note: Most of the time you should not override this method and should instead // use BindFactory<>.FromIFactory if you want to do some custom logic #if !NOT_UNITY3D [NotNull] #endif public virtual TValue Create() { return CreateInternal(new List()); } protected sealed override IEnumerable ParamTypes { get { yield break; } } } [Obsolete("Zenject.Factory has been renamed to PlaceholderFactory. Zenject.Factory will be removed in future versions")] public class Factory : PlaceholderFactory { } // One parameter public class PlaceholderFactory : PlaceholderFactoryBase, IFactory { // Note: Most of the time you should not override this method and should instead // use BindFactory<>.FromIFactory if you want to do some custom logic #if !NOT_UNITY3D [NotNull] #endif public virtual TValue Create(TParam1 param) { return CreateInternal( new List { InjectUtil.CreateTypePair(param) }); } protected sealed override IEnumerable ParamTypes { get { yield return typeof(TParam1); } } } [Obsolete("Zenject.Factory has been renamed to PlaceholderFactory. Zenject.Factory will be removed in future versions")] public class Factory : PlaceholderFactory { } // Two parameters public class PlaceholderFactory : PlaceholderFactoryBase, IFactory { // Note: Most of the time you should not override this method and should instead // use BindFactory<>.FromIFactory if you want to do some custom logic #if !NOT_UNITY3D [NotNull] #endif public virtual TValue Create(TParam1 param1, TParam2 param2) { return CreateInternal( new List { InjectUtil.CreateTypePair(param1), InjectUtil.CreateTypePair(param2) }); } protected sealed override IEnumerable ParamTypes { get { yield return typeof(TParam1); yield return typeof(TParam2); } } } [Obsolete("Zenject.Factory has been renamed to PlaceholderFactory. Zenject.Factory will be removed in future versions")] public class Factory : PlaceholderFactory { } // Three parameters public class PlaceholderFactory : PlaceholderFactoryBase, IFactory { // Note: Most of the time you should not override this method and should instead // use BindFactory<>.FromIFactory if you want to do some custom logic #if !NOT_UNITY3D [NotNull] #endif public virtual TValue Create(TParam1 param1, TParam2 param2, TParam3 param3) { return CreateInternal( new List { InjectUtil.CreateTypePair(param1), InjectUtil.CreateTypePair(param2), InjectUtil.CreateTypePair(param3) }); } protected sealed override IEnumerable ParamTypes { get { yield return typeof(TParam1); yield return typeof(TParam2); yield return typeof(TParam3); } } } [Obsolete("Zenject.Factory has been renamed to PlaceholderFactory. Zenject.Factory will be removed in future versions")] public class Factory : PlaceholderFactory { } // Four parameters public class PlaceholderFactory : PlaceholderFactoryBase, IFactory { // Note: Most of the time you should not override this method and should instead // use BindFactory<>.FromIFactory if you want to do some custom logic #if !NOT_UNITY3D [NotNull] #endif public virtual TValue Create(TParam1 param1, TParam2 param2, TParam3 param3, TParam4 param4) { return CreateInternal( new List { InjectUtil.CreateTypePair(param1), InjectUtil.CreateTypePair(param2), InjectUtil.CreateTypePair(param3), InjectUtil.CreateTypePair(param4) }); } protected sealed override IEnumerable ParamTypes { get { yield return typeof(TParam1); yield return typeof(TParam2); yield return typeof(TParam3); yield return typeof(TParam4); } } } [Obsolete("Zenject.Factory has been renamed to PlaceholderFactory. Zenject.Factory will be removed in future versions")] public class Factory : PlaceholderFactory { } // Five parameters public class PlaceholderFactory : PlaceholderFactoryBase, IFactory { // Note: Most of the time you should not override this method and should instead // use BindFactory<>.FromIFactory if you want to do some custom logic #if !NOT_UNITY3D [NotNull] #endif public virtual TValue Create(TParam1 param1, TParam2 param2, TParam3 param3, TParam4 param4, TParam5 param5) { return CreateInternal( new List { InjectUtil.CreateTypePair(param1), InjectUtil.CreateTypePair(param2), InjectUtil.CreateTypePair(param3), InjectUtil.CreateTypePair(param4), InjectUtil.CreateTypePair(param5) }); } protected sealed override IEnumerable ParamTypes { get { yield return typeof(TParam1); yield return typeof(TParam2); yield return typeof(TParam3); yield return typeof(TParam4); yield return typeof(TParam5); } } } [Obsolete("Zenject.Factory has been renamed to PlaceholderFactory. Zenject.Factory will be removed in future versions")] public class Factory : PlaceholderFactory { } // Six parameters public class PlaceholderFactory : PlaceholderFactoryBase, IFactory { // Note: Most of the time you should not override this method and should instead // use BindFactory<>.FromIFactory if you want to do some custom logic #if !NOT_UNITY3D [NotNull] #endif public virtual TValue Create(TParam1 param1, TParam2 param2, TParam3 param3, TParam4 param4, TParam5 param5, TParam6 param6) { return CreateInternal( new List { InjectUtil.CreateTypePair(param1), InjectUtil.CreateTypePair(param2), InjectUtil.CreateTypePair(param3), InjectUtil.CreateTypePair(param4), InjectUtil.CreateTypePair(param5), InjectUtil.CreateTypePair(param6) }); } protected sealed override IEnumerable ParamTypes { get { yield return typeof(TParam1); yield return typeof(TParam2); yield return typeof(TParam3); yield return typeof(TParam4); yield return typeof(TParam5); yield return typeof(TParam6); } } } [Obsolete("Zenject.Factory has been renamed to PlaceholderFactory. Zenject.Factory will be removed in future versions")] public class Factory : PlaceholderFactory { } // Ten parameters public class PlaceholderFactory : PlaceholderFactoryBase, IFactory { // If you were hoping to override this method, use BindFactory<>.ToFactory instead public virtual TValue Create(TParam1 param1, TParam2 param2, TParam3 param3, TParam4 param4, TParam5 param5, TParam6 param6, TParam7 param7, TParam8 param8, TParam9 param9, TParam10 param10) { return CreateInternal( new List { InjectUtil.CreateTypePair(param1), InjectUtil.CreateTypePair(param2), InjectUtil.CreateTypePair(param3), InjectUtil.CreateTypePair(param4), InjectUtil.CreateTypePair(param5), InjectUtil.CreateTypePair(param6), InjectUtil.CreateTypePair(param7), InjectUtil.CreateTypePair(param8), InjectUtil.CreateTypePair(param9), InjectUtil.CreateTypePair(param10) }); } protected sealed override IEnumerable ParamTypes { get { yield return typeof(TParam1); yield return typeof(TParam2); yield return typeof(TParam3); yield return typeof(TParam4); yield return typeof(TParam5); yield return typeof(TParam6); yield return typeof(TParam7); yield return typeof(TParam8); yield return typeof(TParam9); yield return typeof(TParam10); } } } [Obsolete("Zenject.Factory has been renamed to PlaceholderFactory. Zenject.Factory will be removed in future versions")] public class Factory : PlaceholderFactory { } }