IKVM11  11
Java SE 11 Virtual Machine for .NET
Loading...
Searching...
No Matches
DelegateCompletionHandler.cs
Go to the documentation of this file.
1using System;
2
3namespace java.nio.channels
4{
5
9 public class DelegateCompletionHandler : DelegateCompletionHandler<object>
10 {
11
17 public DelegateCompletionHandler(Action<object> onCompleted, Action<Exception> onFailed) :
18 base(onCompleted, onFailed)
19 {
20
21 }
22
23 }
24
29 public class DelegateCompletionHandler<V> : DelegateCompletionHandler<V, object>
30 {
31
32
38 public DelegateCompletionHandler(Action<V> onCompleted, Action<Exception> onFailed) :
39 base((r, a) => onCompleted(r), (e, a) => onFailed(e))
40 {
41
42 }
43
44 }
45
50 public class DelegateCompletionHandler<V, A> : CompletionHandler
51 {
52
53 readonly Action<V, A> onCompleted;
54 readonly Action<Exception, A> onFailed;
55
61 public DelegateCompletionHandler(Action<V, A> onCompleted, Action<Exception, A> onFailed)
62 {
63 this.onCompleted = onCompleted;
64 this.onFailed = onFailed;
65 }
66
72 void CompletionHandler.completed(object result, object attachment)
73 {
74 onCompleted((V)result, (A)attachment);
75 }
76
82 void CompletionHandler.failed(Exception exc, object attachment)
83 {
84 onFailed(exc, (A)attachment);
85 }
86
87 }
88
89}
An implementation of a CompletionHandler that accepts a delegate.
DelegateCompletionHandler(Action< object > onCompleted, Action< Exception > onFailed)
Initializes a new instance.
DelegateCompletionHandler(Action< V > onCompleted, Action< Exception > onFailed)
Initializes a new instance.
DelegateCompletionHandler(Action< V, A > onCompleted, Action< Exception, A > onFailed)
Initializes a new instance.