/// <summary>
 /// Convert an Object Visitor into a <see cref="DynamicInstance{T}"/> instance <br />
 /// 将一个对象访问器转换为动态实例 <see cref="DynamicInstance{T}"/>
 /// </summary>
 /// <param name="visitor"></param>
 /// <typeparam name="T"></typeparam>
 /// <returns></returns>
 public static DynamicInstance <T> ToDynamicObject <T>(this IObjectVisitor <T> visitor)
 {
     return(new(visitor));
 }
Beispiel #2
0
 public ObjectTreeWalker( IObjectVisitor visitor )
 {
     myVisitor = visitor;
 }
 /// <summary>
 /// Try to repeat as  <br />
 /// 尝试重复
 /// </summary>
 /// <param name="visitor"></param>
 /// <param name="instance"></param>
 /// <param name="result"></param>
 /// <typeparam name="T"></typeparam>
 /// <returns></returns>
 public static bool TryRepeatAs <T>(this IObjectVisitor <T> visitor, T instance, out T result)
 {
     result = default;
     return(visitor.TryRepeat(instance, out result));
 }
 /// <summary>
 /// Try to repeat as  <br />
 /// 尝试重复
 /// </summary>
 /// <param name="visitor"></param>
 /// <param name="keyValueCollections"></param>
 /// <param name="result"></param>
 /// <typeparam name="T"></typeparam>
 /// <returns></returns>
 public static bool TryRepeatAs <T>(this IObjectVisitor <T> visitor, IDictionary <string, object> keyValueCollections, out T result)
 {
     result = default;
     return(visitor.TryRepeat(keyValueCollections, out result));
 }
Beispiel #5
0
 public override void Accept(IObjectVisitor visitor)
 {
     visitor.Visit(this);
 }
 /// <summary>
 /// Convert an Object Visitor into a <see cref="DynamicInstance"/> instance <br />
 /// 将一个对象访问器转换为动态实例 <see cref="DynamicInstance"/>
 /// </summary>
 /// <param name="visitor"></param>
 /// <returns></returns>
 public static DynamicInstance ToDynamicObject(this IObjectVisitor visitor)
 {
     return(new(visitor));
 }
Beispiel #7
0
 public ObjectLooper(IObjectVisitor visitor, Lazy <MemberHandler> memberHandler, Action <ObjectLoopContext> loopAct)
 {
     _visitor       = visitor ?? throw new ArgumentNullException(nameof(visitor));
     _memberHandler = memberHandler ?? throw new ArgumentNullException(nameof(memberHandler));
     _context       = new InternalObjectLoopingContext(loopAct);
 }
Beispiel #8
0
 public override void Accept(IObjectVisitor visitor)
 {
     throw new Exception("This method shouldn't be called.");
 }
Beispiel #9
0
 public ObjectSelector(IObjectVisitor visitor, Lazy <MemberHandler> memberHandler, Func <ObjectLoopContext, TVal> loopFunc)
 {
     _visitor       = visitor ?? throw new ArgumentNullException(nameof(visitor));
     _memberHandler = memberHandler ?? throw new ArgumentNullException(nameof(memberHandler));
     _context       = new InternalObjectSelectingContext <TVal>(loopFunc);
 }
 public void AcceptVisitor(IObjectVisitor visitor)
 {
     visitor.Visit(value);
 }
 public ValueGetter(IObjectVisitor visitor, string name)
 {
     _visitor = visitor;
     _getter  = () => visitor.GetValue(name);
 }
Beispiel #12
0
 public ObjectTreeWalker(IObjectVisitor visitor)
 {
     myVisitor = visitor;
 }
Beispiel #13
0
 public abstract void Accept(IObjectVisitor visitor);