// source: spine/base/field_filter.proto
/**
* @fileoverview
* @enhanceable
* @suppress {messageConventions} JS Compiler reports an error if a variable or
* field starts with 'MSG_' and isn't a translatable message.
* @public
*/
// GENERATED CODE -- DO NOT EDIT!
var jspb = require('google-protobuf');
var goog = jspb;
var global = Function('return this')();
var spine_options_pb = require('../../spine/options_pb.js');
goog.object.extend(proto, spine_options_pb);
var google_protobuf_any_pb = require('../../google/protobuf/any_pb.js');
goog.object.extend(proto, google_protobuf_any_pb);
goog.exportSymbol('proto.spine.base.FieldFilter', null, global);
/**
* Generated by JsPbCodeGenerator.
* @param {Array=} opt_data Optional initial data array, typically from a
* server response, or constructed directly in Javascript. The array is used
* in place and becomes part of the constructed object. It is not cloned.
* If no data is provided, the constructed object will be empty, but still
* valid.
* @extends {jspb.Message}
* @constructor
*/
proto.spine.base.FieldFilter = function(opt_data) {
jspb.Message.initialize(this, opt_data, 0, -1, proto.spine.base.FieldFilter.repeatedFields_, null);
};
goog.inherits(proto.spine.base.FieldFilter, jspb.Message);
if (goog.DEBUG && !COMPILED) {
/**
* @public
* @override
*/
proto.spine.base.FieldFilter.displayName = 'proto.spine.base.FieldFilter';
}
/**
* List of repeated fields within this message type.
* @private {!Array<number>}
* @const
*/
proto.spine.base.FieldFilter.repeatedFields_ = [2];
if (jspb.Message.GENERATE_TO_OBJECT) {
/**
* Creates an object representation of this proto.
* Field names that are reserved in JavaScript and will be renamed to pb_name.
* Optional fields that are not set will be set to undefined.
* To access a reserved field use, foo.pb_<name>, eg, foo.pb_default.
* For the list of reserved names please see:
* net/proto2/compiler/js/internal/generator.cc#kKeyword.
* @param {boolean=} opt_includeInstance Deprecated. whether to include the
* JSPB instance for transitional soy proto support:
* http://goto/soy-param-migration
* @return {!Object}
*/
proto.spine.base.FieldFilter.prototype.toObject = function(opt_includeInstance) {
return proto.spine.base.FieldFilter.toObject(opt_includeInstance, this);
};
/**
* Static version of the {@see toObject} method.
* @param {boolean|undefined} includeInstance Deprecated. Whether to include
* the JSPB instance for transitional soy proto support:
* http://goto/soy-param-migration
* @param {!proto.spine.base.FieldFilter} msg The msg instance to transform.
* @return {!Object}
* @suppress {unusedLocalVariables} f is only used for nested messages
*/
proto.spine.base.FieldFilter.toObject = function(includeInstance, msg) {
var f, obj = {
fieldPath: jspb.Message.getFieldWithDefault(msg, 1, ""),
valueList: jspb.Message.toObjectList(msg.getValueList(),
google_protobuf_any_pb.Any.toObject, includeInstance)
};
if (includeInstance) {
obj.$jspbMessageInstance = msg;
}
return obj;
};
}
/**
* Deserializes binary data (in protobuf wire format).
* @param {jspb.ByteSource} bytes The bytes to deserialize.
* @return {!proto.spine.base.FieldFilter}
*/
proto.spine.base.FieldFilter.deserializeBinary = function(bytes) {
var reader = new jspb.BinaryReader(bytes);
var msg = new proto.spine.base.FieldFilter;
return proto.spine.base.FieldFilter.deserializeBinaryFromReader(msg, reader);
};
/**
* Deserializes binary data (in protobuf wire format) from the
* given reader into the given message object.
* @param {!proto.spine.base.FieldFilter} msg The message object to deserialize into.
* @param {!jspb.BinaryReader} reader The BinaryReader to use.
* @return {!proto.spine.base.FieldFilter}
*/
proto.spine.base.FieldFilter.deserializeBinaryFromReader = function(msg, reader) {
while (reader.nextField()) {
if (reader.isEndGroup()) {
break;
}
var field = reader.getFieldNumber();
switch (field) {
case 1:
var value = /** @type {string} */ (reader.readString());
msg.setFieldPath(value);
break;
case 2:
var value = new google_protobuf_any_pb.Any;
reader.readMessage(value,google_protobuf_any_pb.Any.deserializeBinaryFromReader);
msg.addValue(value);
break;
default:
reader.skipField();
break;
}
}
return msg;
};
/**
* Serializes the message to binary data (in protobuf wire format).
* @return {!Uint8Array}
*/
proto.spine.base.FieldFilter.prototype.serializeBinary = function() {
var writer = new jspb.BinaryWriter();
proto.spine.base.FieldFilter.serializeBinaryToWriter(this, writer);
return writer.getResultBuffer();
};
/**
* Serializes the given message to binary data (in protobuf wire
* format), writing to the given BinaryWriter.
* @param {!proto.spine.base.FieldFilter} message
* @param {!jspb.BinaryWriter} writer
* @suppress {unusedLocalVariables} f is only used for nested messages
*/
proto.spine.base.FieldFilter.serializeBinaryToWriter = function(message, writer) {
var f = undefined;
f = message.getFieldPath();
if (f.length > 0) {
writer.writeString(
1,
f
);
}
f = message.getValueList();
if (f.length > 0) {
writer.writeRepeatedMessage(
2,
f,
google_protobuf_any_pb.Any.serializeBinaryToWriter
);
}
};
/**
* optional string field_path = 1;
* @return {string}
*/
proto.spine.base.FieldFilter.prototype.getFieldPath = function() {
return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, ""));
};
/**
* @param {string} value
* @return {!proto.spine.base.FieldFilter} returns this
*/
proto.spine.base.FieldFilter.prototype.setFieldPath = function(value) {
return jspb.Message.setProto3StringField(this, 1, value);
};
/**
* repeated google.protobuf.Any value = 2;
* @return {!Array<!proto.google.protobuf.Any>}
*/
proto.spine.base.FieldFilter.prototype.getValueList = function() {
return /** @type{!Array<!proto.google.protobuf.Any>} */ (
jspb.Message.getRepeatedWrapperField(this, google_protobuf_any_pb.Any, 2));
};
/**
* @param {!Array<!proto.google.protobuf.Any>} value
* @return {!proto.spine.base.FieldFilter} returns this
*/
proto.spine.base.FieldFilter.prototype.setValueList = function(value) {
return jspb.Message.setRepeatedWrapperField(this, 2, value);
};
/**
* @param {!proto.google.protobuf.Any=} opt_value
* @param {number=} opt_index
* @return {!proto.google.protobuf.Any}
*/
proto.spine.base.FieldFilter.prototype.addValue = function(opt_value, opt_index) {
return jspb.Message.addToRepeatedWrapperField(this, 2, opt_value, proto.google.protobuf.Any, opt_index);
};
/**
* Clears the list making it empty but non-null.
* @return {!proto.spine.base.FieldFilter} returns this
*/
proto.spine.base.FieldFilter.prototype.clearValueList = function() {
return this.setValueList([]);
};
goog.object.extend(exports, proto.spine.base);
// Generated by Spine ProtoJs Plugin
let ObjectParser = require('../../../client/parser/object-parser.js').default;
let TypeParsers = require('../../../client/parser/type-parsers.js').default;
proto.spine.base.FieldFilter.Parser = function() {
ObjectParser.call(this);
};
proto.spine.base.FieldFilter.Parser.prototype = Object.create(ObjectParser.prototype);
proto.spine.base.FieldFilter.Parser.prototype.constructor = proto.spine.base.FieldFilter.Parser;
proto.spine.base.FieldFilter.Parser.prototype.fromObject = function(obj) {
if (obj === null) {
return null;
}
let msg = new proto.spine.base.FieldFilter();
if (obj.fieldPath !== undefined) {
if (obj.fieldPath !== null) {
let value = obj.fieldPath;
msg.setFieldPath(value);
}
}
if (obj.value !== undefined && obj.value !== null) {
obj.value.forEach(
(listItem, index, array) => {
if (listItem === null) {
msg.addValue(null);
} else {
let value = TypeParsers.parserFor('type.googleapis.com/google.protobuf.Any').fromObject(listItem);
msg.addValue(value);
}
}
);
}
return msg;
};
// Generated by Spine ProtoJs Plugin
proto.spine.base.FieldFilter.typeUrl = function() {
return 'type.spine.io/spine.base.FieldFilter';
};