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.codec.messaging.DeleteOnNoMessagesType; 14 15 import hunt.Object; 16 import hunt.collection.Collections; 17 import hunt.collection.List; 18 import hunt.collection.ArrayList; 19 import hunt.proton.amqp.Symbol; 20 import hunt.proton.amqp.UnsignedLong; 21 import hunt.proton.amqp.messaging.DeleteOnNoMessages; 22 import hunt.proton.codec.AbstractDescribedType; 23 import hunt.proton.codec.Decoder; 24 import hunt.proton.codec.DescribedTypeConstructor; 25 import hunt.proton.codec.EncoderImpl; 26 import std.concurrency : initOnce; 27 import hunt.Exceptions; 28 29 class DeleteOnNoMessagesType : AbstractDescribedType!(DeleteOnNoMessages,List!Object) , DescribedTypeConstructor!(DeleteOnNoMessages) 30 { 31 //private static Object[] DESCRIPTORS = 32 //{ 33 // UnsignedLong.valueOf(0x000000000000002dL), Symbol.valueOf("amqp:delete-on-no-messages:list"), 34 //}; 35 36 // private static UnsignedLong DESCRIPTOR = UnsignedLong.valueOf(0x000000000000002dL); 37 38 static Object[] DESCRIPTORS() { 39 __gshared Object[] inst; 40 return initOnce!inst([UnsignedLong.valueOf(0x000000000000002dL), Symbol.valueOf("amqp:delete-on-no-messages:list")]); 41 } 42 43 static UnsignedLong DESCRIPTOR() { 44 __gshared UnsignedLong inst; 45 return initOnce!inst(UnsignedLong.valueOf(0x000000000000002dL)); 46 } 47 48 this(EncoderImpl encoder) 49 { 50 super(encoder); 51 } 52 53 override 54 public UnsignedLong getDescriptor() 55 { 56 return DESCRIPTOR; 57 } 58 59 override 60 protected List!Object wrap(DeleteOnNoMessages val) 61 { 62 return new ArrayList!Object(); 63 } 64 65 override 66 public DeleteOnNoMessages newInstance(Object described) 67 { 68 return DeleteOnNoMessages.getInstance(); 69 } 70 71 override 72 public TypeInfo getTypeClass() 73 { 74 return typeid(DeleteOnNoMessages); 75 } 76 77 public static void register(Decoder decoder, EncoderImpl encoder) 78 { 79 DeleteOnNoMessagesType type = new DeleteOnNoMessagesType(encoder); 80 //implementationMissing(false); 81 foreach(Object descriptor ; DESCRIPTORS) 82 { 83 decoder.registerDynamic(descriptor, type); 84 } 85 encoder.register(type); 86 } 87 } 88