public RuntimeMember Find(IdentifierName memberName, int parameterCount, Func<KeyValuePair<string, Accessor>, bool> filter) { foreach (KeyValuePair<string, Accessor> accessor in accessors) { if (!filter(accessor)) continue; if (parameterCount == 1) return new SetterMember(accessor.Value); if (parameterCount == 0) return new GetterMember(accessor.Value); } throw new ArgumentException(string.Format("Missing member '{0}'", memberName.SourceName)); }
public bool Equals(IdentifierName other) { return other != null && Matches(other.MatchName); }
public RuntimeMember Find(IdentifierName memberName, int parameterCount, IList<Type> parameterTypes) { return columnAccessors.Find(memberName, parameterCount, accessor => { string accessorName = accessor.Key.EndsWith("=") ? accessor.Key.Substring(0, accessor.Key.Length - 1) : accessor.Key; if (!memberName.Matches(accessorName)) return false; if (currentHeader != null && currentHeader.Text.EndsWith("=") && !accessor.Key.EndsWith("=")) return false; if (currentHeader != null && !currentHeader.Text.EndsWith("=") && accessor.Key.EndsWith("=")) return false; return true; }); }
public RuntimeMember Find(IdentifierName memberName, int parameterCount, Type[] parameterTypes) { return new QueryableMember(memberName.ToString()); }
public bool Equals(IdentifierName other) { return(other != null && Matches(other.MatchName)); }
public static RuntimeMember GetInstance(TypedValue instance, IdentifierName memberName, int parameterCount) { RuntimeMember runtimeMember = FindInstance(instance.Value, memberName, parameterCount); if (runtimeMember == null) throw new MemberMissingException(instance.Type, memberName.SourceName, parameterCount); return runtimeMember; }
public RuntimeMember FindStatic(IdentifierName memberName, Type[] parameterTypes) { return new MemberQuery(memberName, parameterTypes.Length, BindingFlags.Static) .WithParameterTypes(parameterTypes) .Find(Type); }
public static RuntimeMember FindInstance(object instance, IdentifierName memberName, IList<string> parameterNames) { return new MemberQuery(memberName, parameterNames.Count, BindingFlags.Instance | BindingFlags.Static) .WithParameterNames(parameterNames) .Find(instance); }
public static RuntimeMember FindInstance(object instance, IdentifierName memberName, Type[] parameterTypes) { return new MemberQuery(memberName, parameterTypes.Length, BindingFlags.Instance | BindingFlags.Static) .WithParameterTypes(parameterTypes) .Find(instance); }
public static RuntimeMember FindInstance(object instance, IdentifierName memberName, int parameterCount) { return new MemberQuery(memberName, parameterCount, BindingFlags.Instance | BindingFlags.Static).Find(instance); }
public MemberQuery(IdentifierName memberName, int parameterCount, BindingFlags flags) { this.memberName = memberName; this.parameterCount = parameterCount; this.flags = flags; }
public RuntimeMember Find(IdentifierName memberName, int parameterCount, Type[] parameterTypes) { return columnAccessors.Find(memberName, parameterCount, accessor => memberName.Matches(accessor.Key)); }
public bool MatchesGetSetName(string name) { var identifier = new IdentifierName(memberName.Name); if (identifier.Matches(name)) return true; if (!identifier.MatchName.StartsWith("set") && !identifier.MatchName.StartsWith("get")) return false; return new IdentifierName(identifier.MatchName.Substring(3)).Matches(name); }
public MemberQuery(string memberName, int parameterCount, BindingFlags flags, Type[] parameterTypes) { this.memberName = new IdentifierName(memberName); this.parameterCount = parameterCount; this.flags = flags; this.parameterTypes = parameterTypes; }