All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.apache.pulsar.common.api.proto.CommandGetTopicsOfNamespace Maven / Gradle / Ivy

package org.apache.pulsar.common.api.proto;
public final class CommandGetTopicsOfNamespace {
	public enum Mode {
		PERSISTENT(0), NON_PERSISTENT(1), ALL(2),;
		private final int value;
		private Mode(int value) {
			this.value = value;
		}
		public int getValue() {
			return value;
		}
		public static Mode valueOf(int n) {
			switch (n) {
				case 0 :
					return PERSISTENT;
				case 1 :
					return NON_PERSISTENT;
				case 2 :
					return ALL;
				default :
					return null;

			}
		}
		public static final int PERSISTENT_VALUE = 0;
		public static final int NON_PERSISTENT_VALUE = 1;
		public static final int ALL_VALUE = 2;
	}

	private long requestId;
	private static final int _REQUEST_ID_FIELD_NUMBER = 1;
	private static final int _REQUEST_ID_TAG = (_REQUEST_ID_FIELD_NUMBER << LightProtoCodec.TAG_TYPE_BITS)
			| LightProtoCodec.WIRETYPE_VARINT;
	private static final int _REQUEST_ID_TAG_SIZE = LightProtoCodec.computeVarIntSize(_REQUEST_ID_TAG);
	private static final int _REQUEST_ID_MASK = 1 << (0 % 32);
	public boolean hasRequestId() {
		return (_bitField0 & _REQUEST_ID_MASK) != 0;
	}
	public long getRequestId() {
		if (!hasRequestId()) {
			throw new IllegalStateException("Field 'request_id' is not set");
		}
		return requestId;
	}
	public CommandGetTopicsOfNamespace setRequestId(long requestId) {
		this.requestId = requestId;
		_bitField0 |= _REQUEST_ID_MASK;
		_cachedSize = -1;
		return this;
	}
	public CommandGetTopicsOfNamespace clearRequestId() {
		_bitField0 &= ~_REQUEST_ID_MASK;
		return this;
	}

	private String namespace;
	private int _namespaceBufferIdx = -1;
	private int _namespaceBufferLen = -1;
	private static final int _NAMESPACE_FIELD_NUMBER = 2;
	private static final int _NAMESPACE_TAG = (_NAMESPACE_FIELD_NUMBER << LightProtoCodec.TAG_TYPE_BITS)
			| LightProtoCodec.WIRETYPE_LENGTH_DELIMITED;
	private static final int _NAMESPACE_TAG_SIZE = LightProtoCodec.computeVarIntSize(_NAMESPACE_TAG);
	private static final int _NAMESPACE_MASK = 1 << (1 % 32);
	public boolean hasNamespace() {
		return (_bitField0 & _NAMESPACE_MASK) != 0;
	}
	public String getNamespace() {
		if (!hasNamespace()) {
			throw new IllegalStateException("Field 'namespace' is not set");
		}
		if (namespace == null) {
			namespace = LightProtoCodec.readString(_parsedBuffer, _namespaceBufferIdx, _namespaceBufferLen);
		}
		return namespace;
	}
	public CommandGetTopicsOfNamespace setNamespace(String namespace) {
		this.namespace = namespace;
		_bitField0 |= _NAMESPACE_MASK;
		_namespaceBufferIdx = -1;
		_namespaceBufferLen = LightProtoCodec.computeStringUTF8Size(namespace);
		_cachedSize = -1;
		return this;
	}
	public CommandGetTopicsOfNamespace clearNamespace() {
		_bitField0 &= ~_NAMESPACE_MASK;
		namespace = null;
		_namespaceBufferIdx = -1;
		_namespaceBufferLen = -1;
		return this;
	}

	private Mode mode = Mode.PERSISTENT;
	private static final int _MODE_FIELD_NUMBER = 3;
	private static final int _MODE_TAG = (_MODE_FIELD_NUMBER << LightProtoCodec.TAG_TYPE_BITS)
			| LightProtoCodec.WIRETYPE_VARINT;
	private static final int _MODE_TAG_SIZE = LightProtoCodec.computeVarIntSize(_MODE_TAG);
	private static final int _MODE_MASK = 1 << (2 % 32);
	public boolean hasMode() {
		return (_bitField0 & _MODE_MASK) != 0;
	}
	public Mode getMode() {
		return mode;
	}
	public CommandGetTopicsOfNamespace setMode(Mode mode) {
		this.mode = mode;
		_bitField0 |= _MODE_MASK;
		_cachedSize = -1;
		return this;
	}
	public CommandGetTopicsOfNamespace clearMode() {
		_bitField0 &= ~_MODE_MASK;
		mode = Mode.PERSISTENT;
		return this;
	}

	private String topicsPattern;
	private int _topicsPatternBufferIdx = -1;
	private int _topicsPatternBufferLen = -1;
	private static final int _TOPICS_PATTERN_FIELD_NUMBER = 4;
	private static final int _TOPICS_PATTERN_TAG = (_TOPICS_PATTERN_FIELD_NUMBER << LightProtoCodec.TAG_TYPE_BITS)
			| LightProtoCodec.WIRETYPE_LENGTH_DELIMITED;
	private static final int _TOPICS_PATTERN_TAG_SIZE = LightProtoCodec.computeVarIntSize(_TOPICS_PATTERN_TAG);
	private static final int _TOPICS_PATTERN_MASK = 1 << (3 % 32);
	public boolean hasTopicsPattern() {
		return (_bitField0 & _TOPICS_PATTERN_MASK) != 0;
	}
	public String getTopicsPattern() {
		if (!hasTopicsPattern()) {
			throw new IllegalStateException("Field 'topics_pattern' is not set");
		}
		if (topicsPattern == null) {
			topicsPattern = LightProtoCodec.readString(_parsedBuffer, _topicsPatternBufferIdx, _topicsPatternBufferLen);
		}
		return topicsPattern;
	}
	public CommandGetTopicsOfNamespace setTopicsPattern(String topicsPattern) {
		this.topicsPattern = topicsPattern;
		_bitField0 |= _TOPICS_PATTERN_MASK;
		_topicsPatternBufferIdx = -1;
		_topicsPatternBufferLen = LightProtoCodec.computeStringUTF8Size(topicsPattern);
		_cachedSize = -1;
		return this;
	}
	public CommandGetTopicsOfNamespace clearTopicsPattern() {
		_bitField0 &= ~_TOPICS_PATTERN_MASK;
		topicsPattern = null;
		_topicsPatternBufferIdx = -1;
		_topicsPatternBufferLen = -1;
		return this;
	}

	private String topicsHash;
	private int _topicsHashBufferIdx = -1;
	private int _topicsHashBufferLen = -1;
	private static final int _TOPICS_HASH_FIELD_NUMBER = 5;
	private static final int _TOPICS_HASH_TAG = (_TOPICS_HASH_FIELD_NUMBER << LightProtoCodec.TAG_TYPE_BITS)
			| LightProtoCodec.WIRETYPE_LENGTH_DELIMITED;
	private static final int _TOPICS_HASH_TAG_SIZE = LightProtoCodec.computeVarIntSize(_TOPICS_HASH_TAG);
	private static final int _TOPICS_HASH_MASK = 1 << (4 % 32);
	public boolean hasTopicsHash() {
		return (_bitField0 & _TOPICS_HASH_MASK) != 0;
	}
	public String getTopicsHash() {
		if (!hasTopicsHash()) {
			throw new IllegalStateException("Field 'topics_hash' is not set");
		}
		if (topicsHash == null) {
			topicsHash = LightProtoCodec.readString(_parsedBuffer, _topicsHashBufferIdx, _topicsHashBufferLen);
		}
		return topicsHash;
	}
	public CommandGetTopicsOfNamespace setTopicsHash(String topicsHash) {
		this.topicsHash = topicsHash;
		_bitField0 |= _TOPICS_HASH_MASK;
		_topicsHashBufferIdx = -1;
		_topicsHashBufferLen = LightProtoCodec.computeStringUTF8Size(topicsHash);
		_cachedSize = -1;
		return this;
	}
	public CommandGetTopicsOfNamespace clearTopicsHash() {
		_bitField0 &= ~_TOPICS_HASH_MASK;
		topicsHash = null;
		_topicsHashBufferIdx = -1;
		_topicsHashBufferLen = -1;
		return this;
	}

	private int _bitField0;
	private static final int _REQUIRED_FIELDS_MASK0 = 0 | _REQUEST_ID_MASK | _NAMESPACE_MASK;
	public int writeTo(org.apache.pulsar.shade.io.netty.buffer.ByteBuf _b) {
		checkRequiredFields();
		int _writeIdx = _b.writerIndex();
		LightProtoCodec.writeVarInt(_b, _REQUEST_ID_TAG);
		LightProtoCodec.writeVarInt64(_b, requestId);
		LightProtoCodec.writeVarInt(_b, _NAMESPACE_TAG);
		LightProtoCodec.writeVarInt(_b, _namespaceBufferLen);
		if (_namespaceBufferIdx == -1) {
			LightProtoCodec.writeString(_b, namespace, _namespaceBufferLen);
		} else {
			_parsedBuffer.getBytes(_namespaceBufferIdx, _b, _namespaceBufferLen);
		}
		if (hasMode()) {
			LightProtoCodec.writeVarInt(_b, _MODE_TAG);
			LightProtoCodec.writeVarInt(_b, mode.getValue());
		}
		if (hasTopicsPattern()) {
			LightProtoCodec.writeVarInt(_b, _TOPICS_PATTERN_TAG);
			LightProtoCodec.writeVarInt(_b, _topicsPatternBufferLen);
			if (_topicsPatternBufferIdx == -1) {
				LightProtoCodec.writeString(_b, topicsPattern, _topicsPatternBufferLen);
			} else {
				_parsedBuffer.getBytes(_topicsPatternBufferIdx, _b, _topicsPatternBufferLen);
			}
		}
		if (hasTopicsHash()) {
			LightProtoCodec.writeVarInt(_b, _TOPICS_HASH_TAG);
			LightProtoCodec.writeVarInt(_b, _topicsHashBufferLen);
			if (_topicsHashBufferIdx == -1) {
				LightProtoCodec.writeString(_b, topicsHash, _topicsHashBufferLen);
			} else {
				_parsedBuffer.getBytes(_topicsHashBufferIdx, _b, _topicsHashBufferLen);
			}
		}
		return (_b.writerIndex() - _writeIdx);
	}
	public int getSerializedSize() {
		if (_cachedSize > -1) {
			return _cachedSize;
		}

		int _size = 0;
		_size += _REQUEST_ID_TAG_SIZE;
		_size += LightProtoCodec.computeVarInt64Size(requestId);
		_size += _NAMESPACE_TAG_SIZE;
		_size += LightProtoCodec.computeVarIntSize(_namespaceBufferLen);
		_size += _namespaceBufferLen;
		if (hasMode()) {
			_size += _MODE_TAG_SIZE;
			_size += LightProtoCodec.computeVarIntSize(mode.getValue());
		}
		if (hasTopicsPattern()) {
			_size += _TOPICS_PATTERN_TAG_SIZE;
			_size += LightProtoCodec.computeVarIntSize(_topicsPatternBufferLen);
			_size += _topicsPatternBufferLen;
		}
		if (hasTopicsHash()) {
			_size += _TOPICS_HASH_TAG_SIZE;
			_size += LightProtoCodec.computeVarIntSize(_topicsHashBufferLen);
			_size += _topicsHashBufferLen;
		}
		_cachedSize = _size;
		return _size;
	}
	public void parseFrom(org.apache.pulsar.shade.io.netty.buffer.ByteBuf _buffer, int _size) {
		clear();
		int _endIdx = _buffer.readerIndex() + _size;
		while (_buffer.readerIndex() < _endIdx) {
			int _tag = LightProtoCodec.readVarInt(_buffer);
			switch (_tag) {
				case _REQUEST_ID_TAG :
					_bitField0 |= _REQUEST_ID_MASK;
					requestId = LightProtoCodec.readVarInt64(_buffer);
					break;
				case _NAMESPACE_TAG :
					_bitField0 |= _NAMESPACE_MASK;
					_namespaceBufferLen = LightProtoCodec.readVarInt(_buffer);
					_namespaceBufferIdx = _buffer.readerIndex();
					_buffer.skipBytes(_namespaceBufferLen);
					break;
				case _MODE_TAG :
					Mode _mode = Mode.valueOf(LightProtoCodec.readVarInt(_buffer));
					if (_mode != null) {
						_bitField0 |= _MODE_MASK;
						mode = _mode;
					}
					break;
				case _TOPICS_PATTERN_TAG :
					_bitField0 |= _TOPICS_PATTERN_MASK;
					_topicsPatternBufferLen = LightProtoCodec.readVarInt(_buffer);
					_topicsPatternBufferIdx = _buffer.readerIndex();
					_buffer.skipBytes(_topicsPatternBufferLen);
					break;
				case _TOPICS_HASH_TAG :
					_bitField0 |= _TOPICS_HASH_MASK;
					_topicsHashBufferLen = LightProtoCodec.readVarInt(_buffer);
					_topicsHashBufferIdx = _buffer.readerIndex();
					_buffer.skipBytes(_topicsHashBufferLen);
					break;
				default :
					LightProtoCodec.skipUnknownField(_tag, _buffer);
			}
		}
		checkRequiredFields();
		_parsedBuffer = _buffer;
	}
	private void checkRequiredFields() {
		if ((_bitField0 & _REQUIRED_FIELDS_MASK0) != _REQUIRED_FIELDS_MASK0) {
			throw new IllegalStateException("Some required fields are missing");
		}
	}
	public CommandGetTopicsOfNamespace clear() {
		namespace = null;
		_namespaceBufferIdx = -1;
		_namespaceBufferLen = -1;
		mode = Mode.PERSISTENT;
		topicsPattern = null;
		_topicsPatternBufferIdx = -1;
		_topicsPatternBufferLen = -1;
		topicsHash = null;
		_topicsHashBufferIdx = -1;
		_topicsHashBufferLen = -1;
		_parsedBuffer = null;
		_cachedSize = -1;
		_bitField0 = 0;
		return this;
	}
	public CommandGetTopicsOfNamespace copyFrom(CommandGetTopicsOfNamespace _other) {
		_cachedSize = -1;
		if (_other.hasRequestId()) {
			setRequestId(_other.requestId);
		}
		if (_other.hasNamespace()) {
			setNamespace(_other.getNamespace());
		}
		if (_other.hasMode()) {
			setMode(_other.mode);
		}
		if (_other.hasTopicsPattern()) {
			setTopicsPattern(_other.getTopicsPattern());
		}
		if (_other.hasTopicsHash()) {
			setTopicsHash(_other.getTopicsHash());
		}
		return this;
	}
	public byte[] toByteArray() {
		byte[] a = new byte[getSerializedSize()];
		io.netty.buffer.ByteBuf b = io.netty.buffer.Unpooled.wrappedBuffer(a).writerIndex(0);
		this.writeTo(b);
		return a;
	}
	public void parseFrom(byte[] a) {
		io.netty.buffer.ByteBuf b = io.netty.buffer.Unpooled.wrappedBuffer(a);
		this.parseFrom(b, b.readableBytes());
	}
	private int _cachedSize;

	private org.apache.pulsar.shade.io.netty.buffer.ByteBuf _parsedBuffer;

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy