/// <summary>
		/// Initializes this object with a message.
		/// </summary>
		public ValidationResult(string message, object target, string key, string tag, Validator validator,
			IEnumerable<ValidationResult> nestedValidationResults)
		{
			this.message = message;
			this.key = key;
			this.target = target;
			this.tag = tag;
			this.validator = validator;
			this.nestedValidationResults = nestedValidationResults;
		}
 private static bool CheckIfValidatorIsAppropiate(Validator validator)
 {
     if (IsComposite(validator))
     {
         return CompositeHasValidators(validator);
     }
     else
     {
         return true;
     }
 }
        private static bool CompositeHasValidators(Validator validator)
        {
            AndCompositeValidator andValidator = validator as AndCompositeValidator;

            if (andValidator != null)
            {
                return ((Validator[])andValidator.Validators).Length > 0;
            }

            OrCompositeValidator orValidator = validator as OrCompositeValidator;

            if (orValidator != null)
            {
                return ((Validator[])orValidator.Validators).Length > 0;
            }

            return false;
        }
 private static bool IsComposite(Validator validator)
 {
     return validator is AndCompositeValidator || validator is OrCompositeValidator;
 }
		/// <summary>
		/// Initializes this object with a message.
		/// </summary>
		public ValidationResult(string message, object target, string key, string tag, Validator validator)
			: this(message, target, key, tag, validator, NoNestedValidationResults)
		{ }
        private string GetValidationMessage(Validator validator)
        {
            if (validator == null)
                return "";

            var results = validator.Validate(this.target);
            if (results.IsValid)
                return "";

            var errorTextBuilder = new StringBuilder();
            foreach (var result in results)
            {
                errorTextBuilder.AppendLine(result.Message);
            }

            return errorTextBuilder.ToString();
        }
 /// <summary>
 /// Adds a value validator to the composite validator.
 /// </summary>
 /// <param name="valueValidator">The validator to add.</param>
 public void AddValueValidator(Validator valueValidator)
 {
     this.valueValidators.Add(valueValidator);
 }
        /// <summary>
        /// Returns the validator created by the builder.
        /// </summary>
        public Validator GetValidator()
        {
            this.builtValidator = this.DoGetValidator();

            return this.builtValidator;
        }