/// <inheritdoc /> protected ValueCompareBasicToken(VerifiableMemberContract contract, object valueToCompare, string tokenName) : base(contract) { _valueToCompare = valueToCompare; _valueToCompareFunc = null; _typeOfValueToCompare = _valueToCompare.GetType(); TokenName = tokenName; }
/// <inheritdoc /> protected ValueCompareBasicToken(VerifiableMemberContract contract, Func <object> valueToCompareFunc, Type valueType, string tokenName) : base(contract) { _valueToCompare = default; _valueToCompareFunc = valueToCompareFunc; _typeOfValueToCompare = valueType; TokenName = tokenName; }
/// <inheritdoc /> public ValueRangeToken(VerifiableMemberContract contract, TVal from, TVal to, RangeOptions options) : base(contract) { _from = from; _to = to; _options = options; }
/// <inheritdoc /> public ValueMinLengthLimitedToken(VerifiableMemberContract contract, int min) : base(contract) { if (min < 0) { throw new ArgumentOutOfRangeException(nameof(min)); } _minLength = min; }
/// <inheritdoc /> public ValueMaxLengthLimitedToken(VerifiableMemberContract contract, int max) : base(contract) { if (max < 0) { throw new ArgumentOutOfRangeException(nameof(max)); } _maxLength = max; }
public ValueValidationRegistrar( VerifiableMemberContract verifiableMemberContract, List <CorrectValueRule> rules, VerifyRuleMode mode, IFluentValidationRegistrar <T> parentRegistrar, IValidationRegistrar rootRegistrar) : base(verifiableMemberContract, rules, mode, parentRegistrar, rootRegistrar) { ValueRuleBuilder = new CorrectValueRuleBuilder <T, TVal>(verifiableMemberContract, mode); }
/// <inheritdoc /> public ValueStringEnumToken(VerifiableMemberContract contract, Type enumType, bool caseSensitive) : base(contract) { _enumType = enumType ?? throw new ArgumentNullException(nameof(enumType)); _caseSensitive = caseSensitive; if (!enumType.IsEnum) { throw new ArgumentOutOfRangeException(nameof(enumType), $"The type '{enumType.Name}' is not an enum and can't be used with IsEnumName."); } }
public GroupedValueToken(VerifiableMemberContract contract, bool internalLogic = true) { _contract = contract; WorkingList = new List <IValueToken>(); _correctValueRule = new LogicCorrectValueRule { Contract = contract, MemberName = MemberName, Mode = CorrectValueRuleMode.Append, Tokens = WorkingList }; TokenName = CreateName(_contract); Relationship = ConditionOps.Break; LogicFlag = internalLogic; }
protected ValueRequiredBasicToken( VerifiableMemberContract contract, bool not, string tokenName, int[] mutuallyExclusiveFlags = null, bool?mutuallyExclusive = null) : base(contract) { Not = not; TokenName = tokenName; MutuallyExclusive = mutuallyExclusive ?? mutuallyExclusiveFlags is not null; MutuallyExclusiveFlags = mutuallyExclusiveFlags ?? NoMutuallyExclusiveFlags; }
public ValueValidationRegistrar( VerifiableMemberContract verifiableMemberContract, List <CorrectValueRule> rules, VerifyRuleMode mode, IFluentValidationRegistrar parentRegistrar, IValidationRegistrar rootRegistrar) { _rootRegistrar = rootRegistrar ?? throw new ArgumentNullException(nameof(rootRegistrar)); _parentRegistrar = parentRegistrar ?? throw new ArgumentNullException(nameof(parentRegistrar)); _verifiableMemberContract = verifiableMemberContract ?? throw new ArgumentNullException(nameof(verifiableMemberContract)); ValueRuleBuilder = new CorrectValueRuleBuilder(verifiableMemberContract, mode); _parentRulesRef = rules; }
/// <inheritdoc /> public ValueLengthLimitedToken(VerifiableMemberContract contract, int min, int max) : base(contract) { if (min < 0) { throw new ArgumentOutOfRangeException(nameof(min)); } if (max != -1 && max < min) { throw new ArgumentOutOfRangeException(nameof(max), "Max should be larger than min."); } _minLength = min; _maxLength = max; }
public CorrectValueRuleNodeState( VerifiableMemberContract contract, IGroupedValueToken groupedToken, IValueToken currentTokenPtr, ConditionOps implicitNextOps = ConditionOps.Break ) { _contract = contract; _rootNode = groupedToken; _workingNode = groupedToken; _currentTokenPtr = currentTokenPtr; _nextOps = implicitNextOps; }
public static bool BasicTypeState(this VerifiableMemberContract contract) { if (contract is null) { return(false); } switch (contract.MemberKind) { case VerifiableMemberKind.CustomContract: return(contract.ExposeInternalImpl().IsBasicType); case VerifiableMemberKind.Unknown: case VerifiableMemberKind.Field: case VerifiableMemberKind.Property: return(contract.IsBasicType); default: return(false); } }
/// <inheritdoc /> public ValueRangeToken(VerifiableMemberContract contract, object from, object to, RangeOptions options) : base(contract) { if (from is null || to is null) { _from = default; _to = default; _returnFalseDirectly = true; } if (!_returnFalseDirectly && from is IComparable from0) { _from = from0; } else { _from = default; _returnFalseDirectly = true; } if (!_returnFalseDirectly && to is IComparable to0) { _to = to0; } else { _to = default; _returnFalseDirectly = true; } if (!_returnFalseDirectly && _from !.CompareTo(_to) > 0) { _returnFalseDirectly = true; } _options = options; }
/// <inheritdoc /> public ValueRegularExpressionToken(VerifiableMemberContract contract, Func <T, string> expressionFunc, RegexOptions options) : base(contract) { _regexFunc = x => CreateRegex(expressionFunc(x), options); }
/// <inheritdoc /> public ValueRegularExpressionToken(VerifiableMemberContract contract, Func <T, Regex> regexFunc) : base(contract) { _regexFunc = regexFunc; }
/// <inheritdoc /> public ValueRegularExpressionToken(VerifiableMemberContract contract, Regex regex) : base(contract) { _regexFunc = x => regex; }
/// <inheritdoc /> public ValueRegularExpressionToken(VerifiableMemberContract contract, string expression) : base(contract) { _regexFunc = x => CreateRegex(expression); }
/// <inheritdoc /> public ValueEnumToken(VerifiableMemberContract contract, Type enumType) : base(contract) { _enumType = enumType ?? throw new ArgumentNullException(nameof(enumType)); }
protected ValueRequiredTypeToken(VerifiableMemberContract contract, Type type, bool not, string tokenName, int[] mutuallyExclusiveFlags = null, bool?mutuallyExclusive = null) : base(contract, not, tokenName, mutuallyExclusiveFlags, mutuallyExclusive) { _type = type ?? throw new ArgumentNullException(nameof(type)); }
private VerifyMemberRulePackage() { DeclaringType = typeof(object); _contract = default; _rule = default; }
/// <inheritdoc /> public ValueAllToken(VerifiableMemberContract contract, Func <object, bool> func) : base(contract, func, Name) { }
/// <inheritdoc /> public ValueInToken(VerifiableMemberContract contract, ICollection <object> objects) : base(contract) { _objects = objects ?? Arrays.Empty <object>(); _objectsFunc = null; }
internal VerifyMemberRulePackage(Type declaringType, VerifiableMemberContract contract, CorrectValueRule rule) { DeclaringType = declaringType ?? throw new ArgumentNullException(nameof(declaringType)); _contract = contract ?? throw new ArgumentNullException(nameof(contract)); _rule = rule ?? throw new ArgumentNullException(nameof(rule)); }
/// <inheritdoc /> public ValueRequiredTypesToken(VerifiableMemberContract contract, params Type[] types) : base(contract, false, Name) { _types = types; }
/// <inheritdoc /> public ValueRequiredTypeToken(VerifiableMemberContract contract, Type type) : base(contract, false, Name, null, true) { _type = type ?? throw new ArgumentNullException(nameof(type)); }
/// <inheritdoc /> public ValueRequiredStringToken(VerifiableMemberContract contract) : base(contract, TypeClass.StringClazz, false, Name, null, true) { }
/// <inheritdoc /> public ValueFuncToken(VerifiableMemberContract contract, Func <object, CustomVerifyResult> func) : base(contract) { _func = func; }
/// <inheritdoc /> public ValueInToken(VerifiableMemberContract contract, Func <ICollection <object> > objectsFunc) : base(contract) { _objects = default; _objectsFunc = objectsFunc; }
/// <inheritdoc /> public ValueScalePrecisionToken(VerifiableMemberContract contract, int scale, int precision, bool ignoreTrailingZeros = false) : base(contract) { Init(scale, precision); IgnoreTrailingZeros = ignoreTrailingZeros; }