/// <summary> /// Initializes a new instance of the <see cref="ObjectDefinitionParser"/> class. /// </summary> /// <param name="domainObjectType">Type of the domain object you are going to configure for DI.</param> /// <param name="identifier">An identifier to use when declaring several configuration for the same domain type.</param> public ObjectDefinitionParser(Type domainObjectType, string identifier) { _domainObjectType = domainObjectType; _identifier = identifier; _autoWiringMode = FluentStaticConfiguration.DefaultWiringMode; _dependencyCheckMode = FluentStaticConfiguration.DefaultDependencyCheckingMode; }
protected AbstractObjectDefinition(SerializationInfo info, StreamingContext context) { constructorArgumentValues = (ConstructorArgumentValues)info.GetValue("constructorArgumentValues", typeof(ConstructorArgumentValues)); propertyValues = (MutablePropertyValues)info.GetValue("propertyValues", typeof(MutablePropertyValues)); eventHandlerValues = (EventValues)info.GetValue("eventHandlerValues", typeof(EventValues)); methodOverrides = (MethodOverrides)info.GetValue("methodOverrides", typeof(MethodOverrides)); resourceDescription = info.GetString("resourceDescription"); isSingleton = info.GetBoolean("isSingleton"); isPrototype = info.GetBoolean("isPrototype"); isLazyInit = info.GetBoolean("isLazyInit"); isAbstract = info.GetBoolean("isAbstract"); scope = info.GetString("scope"); role = (ObjectRole)info.GetValue("role", typeof(ObjectRole)); var objectTypeName = info.GetString("objectTypeName"); objectType = objectTypeName != null?Type.GetType(objectTypeName) : null; autowireMode = (AutoWiringMode)info.GetValue("autowireMode", typeof(AutoWiringMode)); dependencyCheck = (DependencyCheckingMode)info.GetValue("dependencyCheck", typeof(DependencyCheckingMode)); dependsOn = (IList <string>)info.GetValue("dependsOn", typeof(IList <string>)); autowireCandidate = info.GetBoolean("autowireCandidate"); primary = info.GetBoolean("primary"); qualifiers = (IDictionary <string, AutowireCandidateQualifier>)info.GetValue("qualifiers", typeof(IDictionary <string, AutowireCandidateQualifier>)); initMethodName = info.GetString("initMethodName"); destroyMethodName = info.GetString("destroyMethodName"); factoryMethodName = info.GetString("factoryMethodName"); factoryObjectName = info.GetString("factoryObjectName"); }
/// <summary> /// Returns the list of <paramref name="propertyInfos"/> that are not satisfied by <paramref name="properties"/>. /// </summary> /// <returns>the filtered list. Is never <c>null</c></returns> public static IList <PropertyInfo> GetUnsatisfiedDependencies(IList <PropertyInfo> propertyInfos, IPropertyValues properties, DependencyCheckingMode dependencyCheck) { List <PropertyInfo> unsatisfiedDependenciesList = new List <PropertyInfo>(); foreach (PropertyInfo property in propertyInfos) { if (property.CanWrite && properties.GetPropertyValue(property.Name) == null) { bool isSimple = ObjectUtils.IsSimpleProperty(property.PropertyType); bool unsatisfied = (dependencyCheck == DependencyCheckingMode.All) || (isSimple && dependencyCheck == DependencyCheckingMode.Simple) || (!isSimple && dependencyCheck == DependencyCheckingMode.Objects); if (unsatisfied) { unsatisfiedDependenciesList.Add(property); } } } return(unsatisfiedDependenciesList); }
/// <summary> /// Sets the dependency check mode for this definition. /// </summary> /// <param name="dependencyCheck">The dependency check.</param> /// <returns>The current <code>ObjectDefinitionBuilder</code>.</returns> public ObjectDefinitionBuilder SetDependencyCheck(DependencyCheckingMode dependencyCheck) { objectDefinition.DependencyCheck = dependencyCheck; return(this); }
/// <summary> /// Returns the list of <paramref name="propertyInfos"/> that are not satisfied by <paramref name="properties"/>. /// </summary> /// <returns>the filtered list. Is never <c>null</c></returns> public static IList<PropertyInfo> GetUnsatisfiedDependencies(IList<PropertyInfo> propertyInfos, IPropertyValues properties, DependencyCheckingMode dependencyCheck) { List<PropertyInfo> unsatisfiedDependenciesList = new List<PropertyInfo>(); foreach (PropertyInfo property in propertyInfos) { if (property.CanWrite && properties.GetPropertyValue(property.Name) == null) { bool isSimple = ObjectUtils.IsSimpleProperty(property.PropertyType); bool unsatisfied = (dependencyCheck == DependencyCheckingMode.All) || (isSimple && dependencyCheck == DependencyCheckingMode.Simple) || (!isSimple && dependencyCheck == DependencyCheckingMode.Objects); if (unsatisfied) { unsatisfiedDependenciesList.Add(property); } } } return unsatisfiedDependenciesList; }
/// <summary> /// Returns the list of <paramref name="propertyInfos"/> that are not satisfied by <paramref name="properties"/>. /// </summary> /// <returns>the filtered list. Is never <c>null</c></returns> public static PropertyInfo[] GetUnsatisfiedDependencies(PropertyInfo[] propertyInfos, IPropertyValues properties, DependencyCheckingMode dependencyCheck) { ArrayList unsatisfiedDependenciesList = new ArrayList(); foreach (PropertyInfo property in propertyInfos) { if (property.CanWrite && properties.GetPropertyValue(property.Name) == null) { bool isSimple = ObjectUtils.IsSimpleProperty(property.PropertyType); bool unsatisfied = (dependencyCheck == DependencyCheckingMode.All) || (isSimple && dependencyCheck == DependencyCheckingMode.Simple) || (!isSimple && dependencyCheck == DependencyCheckingMode.Objects); if (unsatisfied) { unsatisfiedDependenciesList.Add(property); } } } return (PropertyInfo[])unsatisfiedDependenciesList.ToArray(typeof(PropertyInfo)); }
/// <summary> /// Sets the dependency check mode for this definition. /// </summary> /// <param name="dependencyCheck">The dependency check.</param> /// <returns>The current <code>ObjectDefinitionBuilder</code>.</returns> public ObjectDefinitionBuilder SetDependencyCheck(DependencyCheckingMode dependencyCheck) { objectDefinition.DependencyCheck = dependencyCheck; return this; }
public IReferencingStage <TObject> CheckDependencies(DependencyCheckingMode mode) { _definition.DependencyCheck = mode; return(this); }
public ICanConfigureObject <T> WithDependency(DependencyCheckingMode dependencyMode) { _configurationParser.SetDependencyLevel(dependencyMode); return(this); }
/// <summary> /// Returns the list of <paramref name="propertyInfos"/> that are not satisfied by <paramref name="properties"/>. /// </summary> /// <returns>the filtered list. Is never <c>null</c></returns> public static PropertyInfo[] GetUnsatisfiedDependencies(PropertyInfo[] propertyInfos, IPropertyValues properties, DependencyCheckingMode dependencyCheck) { ArrayList unsatisfiedDependenciesList = new ArrayList(); foreach (PropertyInfo property in propertyInfos) { if (property.CanWrite && properties.GetPropertyValue(property.Name) == null) { bool isSimple = ObjectUtils.IsSimpleProperty(property.PropertyType); bool unsatisfied = (dependencyCheck == DependencyCheckingMode.All) || (isSimple && dependencyCheck == DependencyCheckingMode.Simple) || (!isSimple && dependencyCheck == DependencyCheckingMode.Objects); if (unsatisfied) { unsatisfiedDependenciesList.Add(property); } } } return((PropertyInfo[])unsatisfiedDependenciesList.ToArray(typeof(PropertyInfo))); }
public void SetDependencyLevel(DependencyCheckingMode dependencyMode) { _dependencyCheckMode = dependencyMode; }
public static void SetSpringDefault(AutoWiringMode wiringMode, DependencyCheckingMode dependencyCheckMode) { FluentStaticConfiguration.DefaultWiringMode = wiringMode; FluentStaticConfiguration.DefaultDependencyCheckingMode = dependencyCheckMode; }