1 /*
2  * hunt-proton: AMQP Protocol library for D programming language.
3  *
4  * Copyright (C) 2018-2019 HuntLabs
5  *
6  * Website: https://www.huntlabs.net/
7  *
8  * Licensed under the Apache-2.0 License.
9  *
10  */
11 
12 
13 module hunt.proton.amqp.transport.Close;
14 
15 import hunt.proton.amqp.Binary;
16 import hunt.proton.amqp.transport.FrameBody;
17 import hunt.proton.amqp.transport.ErrorCondition;
18 
19 class Close : FrameBody
20 {
21     private ErrorCondition _error;
22 
23     this() {}
24 
25     this(Close other)
26     {
27         if (other._error !is null)
28         {
29             this._error = new ErrorCondition();
30             this._error.copyFrom(other.getError());
31         }
32     }
33 
34     public ErrorCondition getError()
35     {
36         return _error;
37     }
38 
39     public void setError(ErrorCondition error)
40     {
41         _error = error;
42     }
43 
44     //override
45     public void invoke(E)(FrameBodyHandler!E handler, Binary payload, E context)
46     {
47         handler.handleClose(this, payload, context);
48     }
49 
50 
51     public FrameBody copy()
52     {
53         return new Close(this);
54     }
55 }