/// <summary> /// Gets the hash code /// </summary> /// <returns>Hash code</returns> public override int GetHashCode() { unchecked // Overflow is fine, just wrap { var hashCode = 41; // Suitable nullity checks etc, of course :) if (AllowEmpty != null) { hashCode = hashCode * 59 + AllowEmpty.GetHashCode(); } if (AllowHosts != null) { hashCode = hashCode * 59 + AllowHosts.GetHashCode(); } if (AllowHostsRegexp != null) { hashCode = hashCode * 59 + AllowHostsRegexp.GetHashCode(); } if (FilterMethods != null) { hashCode = hashCode * 59 + FilterMethods.GetHashCode(); } if (ExcludeAgentsRegexp != null) { hashCode = hashCode * 59 + ExcludeAgentsRegexp.GetHashCode(); } return(hashCode); } }
/// <summary> /// Retrieves a collection of client validation rules (rules sent to browsers). /// </summary> /// <returns> /// A collection of client validation rules. /// </returns> public override IEnumerable <ModelClientValidationRule> GetClientValidationRules() { var count = Storage.Get <int>(AnnotatedField) + 1; Assert.AttribsQuantityAllowed(count); Storage.Set(AnnotatedField, count); var suffix = count == 1 ? string.Empty : char.ConvertFromUtf32(95 + count); var rule = new ModelClientValidationRule { ErrorMessage = FormattedErrorMessage, ValidationType = string.Format("requiredif{0}", suffix) }; rule.ValidationParameters.Add("expression", Expression); rule.ValidationParameters.Add("fieldsmap", FieldsMap.ToJson()); rule.ValidationParameters.Add("constsmap", ConstsMap.ToJson()); rule.ValidationParameters.Add("allowempty", AllowEmpty.ToJson()); yield return(rule); }
/// <summary> /// Returns true if OrgApacheSlingSecurityImplReferrerFilterProperties instances are equal /// </summary> /// <param name="other">Instance of OrgApacheSlingSecurityImplReferrerFilterProperties to be compared</param> /// <returns>Boolean</returns> public bool Equals(OrgApacheSlingSecurityImplReferrerFilterProperties other) { if (other is null) { return(false); } if (ReferenceEquals(this, other)) { return(true); } return (( AllowEmpty == other.AllowEmpty || AllowEmpty != null && AllowEmpty.Equals(other.AllowEmpty) ) && ( AllowHosts == other.AllowHosts || AllowHosts != null && AllowHosts.Equals(other.AllowHosts) ) && ( AllowHostsRegexp == other.AllowHostsRegexp || AllowHostsRegexp != null && AllowHostsRegexp.Equals(other.AllowHostsRegexp) ) && ( FilterMethods == other.FilterMethods || FilterMethods != null && FilterMethods.Equals(other.FilterMethods) ) && ( ExcludeAgentsRegexp == other.ExcludeAgentsRegexp || ExcludeAgentsRegexp != null && ExcludeAgentsRegexp.Equals(other.ExcludeAgentsRegexp) )); }