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.DeleteOnNoLinksType; 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.DeleteOnNoLinks; 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 DeleteOnNoLinksType : AbstractDescribedType!(DeleteOnNoLinks,List!Object) , DescribedTypeConstructor!(DeleteOnNoLinks) 30 { 31 //private static Object[] DESCRIPTORS = 32 //{ 33 // UnsignedLong.valueOf(0x000000000000002cL), Symbol.valueOf("amqp:delete-on-no-links:list"), 34 //}; 35 36 static Object[] DESCRIPTORS() { 37 __gshared Object[] inst; 38 return initOnce!inst([UnsignedLong.valueOf(0x000000000000002cL),Symbol.valueOf("amqp:delete-on-no-links:list")]); 39 } 40 41 //private static UnsignedLong DESCRIPTOR = UnsignedLong.valueOf(0x000000000000002cL); 42 43 44 static UnsignedLong DESCRIPTOR() { 45 __gshared UnsignedLong inst; 46 return initOnce!inst(UnsignedLong.valueOf(0x000000000000002cL)); 47 } 48 49 this(EncoderImpl encoder) 50 { 51 super(encoder); 52 } 53 54 55 override 56 public UnsignedLong getDescriptor() 57 { 58 return DESCRIPTOR; 59 } 60 61 override 62 protected List!Object wrap(DeleteOnNoLinks val) 63 { 64 return new ArrayList!Object(); 65 } 66 67 override 68 public DeleteOnNoLinks newInstance(Object described) 69 { 70 return DeleteOnNoLinks.getInstance(); 71 } 72 73 override 74 public TypeInfo getTypeClass() 75 { 76 return typeid(DeleteOnNoLinks); 77 } 78 79 80 81 public static void register(Decoder decoder, EncoderImpl encoder) 82 { 83 DeleteOnNoLinksType type = new DeleteOnNoLinksType(encoder); 84 // implementationMissing(false); 85 foreach(Object descriptor ; DESCRIPTORS) 86 { 87 decoder.registerDynamic(descriptor, type); 88 } 89 encoder.register(type); 90 } 91 } 92