2 * Licensed to the Apache Software Foundation (ASF) under one
3 * or more contributor license agreements. See the NOTICE file
4 * distributed with this work for additional information
5 * regarding copyright ownership. The ASF licenses this file
6 * to you under the Apache License, Version 2.0 (the
7 * "License"); you may not use this file except in compliance
8 * with the License. You may obtain a copy of the License at
10 * http://www.apache.org/licenses/LICENSE-2.0
12 * Unless required by applicable law or agreed to in writing,
13 * software distributed under the License is distributed on an
14 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 * KIND, either express or implied. See the License for the
16 * specific language governing permissions and limitations
20 package org.apache.thrift.protocol;
25 import org.apache.thrift.transport.TTransport;
29 * TProtocolDecorator forwards all requests to an enclosed TProtocol instance,
30 * providing a way to author concise concrete decorator subclasses. While it has
31 * no abstract methods, it is marked abstract as a reminder that by itself,
32 * it does not modify the behaviour of the enclosed TProtocol.
34 * See p.175 of Design Patterns (by Gamma et al.)
35 * See TMultiplexedProtocol
37 class TProtocolDecorator implements TProtocol
39 private var wrapped : TProtocol;
42 * Encloses the specified protocol.
43 * @param protocol All operations will be forward to this protocol. Must be non-null.
45 private function new( protocol : TProtocol) // not to be instantiated, must derive a class
50 public function getTransport() : TTransport {
51 return wrapped.getTransport();
54 public function writeMessageBegin( value : TMessage) : Void {
55 wrapped.writeMessageBegin( value);
58 public function writeMessageEnd() : Void {
59 wrapped.writeMessageEnd();
62 public function writeStructBegin(value : TStruct) : Void {
63 wrapped.writeStructBegin( value);
66 public function writeStructEnd() : Void {
67 wrapped.writeStructEnd();
70 public function writeFieldBegin(value : TField) : Void {
71 wrapped.writeFieldBegin( value);
74 public function writeFieldEnd() : Void {
75 wrapped.writeFieldEnd();
78 public function writeFieldStop() : Void {
79 wrapped.writeFieldStop();
82 public function writeMapBegin( value : TMap) : Void {
83 wrapped.writeMapBegin( value);
86 public function writeMapEnd() : Void {
87 wrapped.writeMapEnd();
90 public function writeListBegin( value : TList) : Void {
91 wrapped.writeListBegin( value);
94 public function writeListEnd() : Void {
95 wrapped.writeListEnd();
98 public function writeSetBegin( value : TSet) : Void {
99 wrapped.writeSetBegin( value);
102 public function writeSetEnd() : Void {
103 wrapped.writeSetEnd();
106 public function writeBool(value : Bool) : Void {
107 wrapped.writeBool( value);
110 public function writeByte(value : Int) : Void {
111 wrapped.writeByte( value);
114 public function writeI16(value : Int) : Void {
115 wrapped.writeI16( value);
118 public function writeI32(value : Int) : Void {
119 wrapped.writeI32( value);
122 public function writeI64(value : haxe.Int64) : Void {
123 wrapped.writeI64( value);
126 public function writeDouble(value : Float) : Void {
127 wrapped.writeDouble( value);
130 public function writeString(value : String) : Void {
131 wrapped.writeString( value);
134 public function writeBinary(value : Bytes ) : Void {
135 wrapped.writeBinary( value);
138 public function readMessageBegin() : TMessage {
139 return wrapped.readMessageBegin();
142 public function readMessageEnd() : Void {
143 wrapped.readMessageEnd();
146 public function readStructBegin() : TStruct {
147 return wrapped.readStructBegin();
150 public function readStructEnd() : Void {
151 wrapped.readStructEnd();
154 public function readFieldBegin() : TField {
155 return wrapped.readFieldBegin();
158 public function readFieldEnd() : Void {
159 wrapped.readFieldEnd();
162 public function readMapBegin() : TMap {
163 return wrapped.readMapBegin();
166 public function readMapEnd() : Void {
167 wrapped.readMapEnd();
170 public function readListBegin() : TList {
171 return wrapped.readListBegin();
174 public function readListEnd() : Void {
175 wrapped.readListEnd();
178 public function readSetBegin() : TSet {
179 return wrapped.readSetBegin();
182 public function readSetEnd() : Void {
183 wrapped.readSetEnd();
186 public function readBool() : Bool
188 return wrapped.readBool();
191 public function readByte() : Int {
192 return wrapped.readByte();
195 public function readI16() : Int {
196 return wrapped.readI16();
199 public function readI32() : Int {
200 return wrapped.readI32();
203 public function readI64() : haxe.Int64 {
204 return wrapped.readI64();
207 public function readDouble() : Float {
208 return wrapped.readDouble();
211 public function readString() : String {
212 return wrapped.readString();
215 public function readBinary() : Bytes {
216 return wrapped.readBinary();
219 public function IncrementRecursionDepth() : Void {
220 return wrapped.IncrementRecursionDepth();
223 public function DecrementRecursionDepth() : Void {
224 return wrapped.DecrementRecursionDepth();