/// <summary> /// Checks whether the method is a generic method. /// </summary> /// <param name="methodAttribute">The <see cref="MethodAttribute{TAttribute}"/> instance to check.</param> /// <returns>True if the method satisfies the constraint, false otherwise.</returns> public bool SatisfiesConstraint(MethodAttribute <TAttribute> methodAttribute) => methodAttribute.Method.IsGenericMethod;
/// <summary> /// Checks whether the method can be called using a parameter pack. /// </summary> /// <param name="methodAttribute">The <see cref="MethodAttribute{TAttribute}"/> instance to check.</param> /// /// <param name="parameterPack">The <see cref="IParameterPack"/> pack.</param> /// <returns>True if the method satisfies the constraint, false otherwise.</returns> public bool SatisfiesConstraint(MethodAttribute <TAttribute> methodAttribute, TParameterPack parameterPack) => parameterPack.CompatibleWith(methodAttribute.Method);
/// <summary> /// Checks whether the method is an instance method. /// </summary> /// <param name="methodAttribute">The <see cref="MethodAttribute{TAttribute}"/> instance to check.</param> /// <returns>True if the method satisfies the constraint, false otherwise.</returns> public bool SatisfiesConstraint(MethodAttribute <TAttribute> methodAttribute) => !methodAttribute.Method.IsStatic;
/// <summary> /// Checks whether the method matches a signature. /// </summary> /// <param name="methodAttribute">The <see cref="MethodAttribute{TAttribute}"/> instance to check.</param> /// <param name="signature">The <see cref="IMethodSignature"/> signature.</param> /// <returns>True if the method satisfies the constraint, false otherwise.</returns> public bool SatisfiesConstraint(MethodAttribute <TAttribute> methodAttribute, TSignature signature) => signature.MatchesExactly(methodAttribute.Method);
/// <summary> /// Checks whether the method is an abstract method. /// </summary> /// <param name="methodAttribute">The <see cref="MethodAttribute{TAttribute}"/> instance to check.</param> /// <returns>True if the method satisfies the constraint, false otherwise.</returns> public bool SatisfiesConstraint(MethodAttribute <TAttribute> methodAttribute) => methodAttribute.Method.IsAbstract;
public static string ParameterPackValidationMessage <TAttribute, TParameterPack>(MethodAttribute <TAttribute> attribute, TParameterPack parameters, string prefix) where TAttribute : Attribute where TParameterPack : IParameterPack => GetMethodPropertyValidationString(prefix, attribute.Type.FullName, attribute.Method.Name, $"be callable using `{parameters.GetPackName()}` parameters");
public static string SignatureValidationMessage <TAttribute>(MethodAttribute <TAttribute> attribute, IMethodSignature signature, string prefix) where TAttribute : Attribute => GetMethodPropertyValidationString(prefix, attribute.Type.FullName, attribute.Method.Name, $"match `{signature.GetSignatureName()}` signature");
public static string GenericValidationMessage <TAttribute>(MethodAttribute <TAttribute> attribute, string prefix) where TAttribute : Attribute => GetMethodPropertyValidationString(prefix, attribute.Type.FullName, attribute.Method.Name, $"{(attribute.Method.IsStatic ? "not " : "")}be generic");