Class: Google::Protobuf::Field

Inherits:
Object
  • Object
show all
Extended by:
MessageExts::ClassMethods
Includes:
MessageExts
Defined in:
proto_docs/google/protobuf/type.rb

Overview

A single field of a message type.

Defined Under Namespace

Modules: Cardinality, Kind

Instance Attribute Summary collapse

Instance Attribute Details

#cardinality::Google::Protobuf::Field::Cardinality

Returns The field cardinality.

Returns:



82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
# File 'proto_docs/google/protobuf/type.rb', line 82

class Field
  include ::Google::Protobuf::MessageExts
  extend ::Google::Protobuf::MessageExts::ClassMethods

  # Basic field types.
  module Kind
    # Field type unknown.
    TYPE_UNKNOWN = 0

    # Field type double.
    TYPE_DOUBLE = 1

    # Field type float.
    TYPE_FLOAT = 2

    # Field type int64.
    TYPE_INT64 = 3

    # Field type uint64.
    TYPE_UINT64 = 4

    # Field type int32.
    TYPE_INT32 = 5

    # Field type fixed64.
    TYPE_FIXED64 = 6

    # Field type fixed32.
    TYPE_FIXED32 = 7

    # Field type bool.
    TYPE_BOOL = 8

    # Field type string.
    TYPE_STRING = 9

    # Field type group. Proto2 syntax only, and deprecated.
    TYPE_GROUP = 10

    # Field type message.
    TYPE_MESSAGE = 11

    # Field type bytes.
    TYPE_BYTES = 12

    # Field type uint32.
    TYPE_UINT32 = 13

    # Field type enum.
    TYPE_ENUM = 14

    # Field type sfixed32.
    TYPE_SFIXED32 = 15

    # Field type sfixed64.
    TYPE_SFIXED64 = 16

    # Field type sint32.
    TYPE_SINT32 = 17

    # Field type sint64.
    TYPE_SINT64 = 18
  end

  # Whether a field is optional, required, or repeated.
  module Cardinality
    # For fields with unknown cardinality.
    CARDINALITY_UNKNOWN = 0

    # For optional fields.
    CARDINALITY_OPTIONAL = 1

    # For required fields. Proto2 syntax only.
    CARDINALITY_REQUIRED = 2

    # For repeated fields.
    CARDINALITY_REPEATED = 3
  end
end

#default_value::String

Returns The string value of the default value of this field. Proto2 syntax only.

Returns:

  • (::String)

    The string value of the default value of this field. Proto2 syntax only.



82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
# File 'proto_docs/google/protobuf/type.rb', line 82

class Field
  include ::Google::Protobuf::MessageExts
  extend ::Google::Protobuf::MessageExts::ClassMethods

  # Basic field types.
  module Kind
    # Field type unknown.
    TYPE_UNKNOWN = 0

    # Field type double.
    TYPE_DOUBLE = 1

    # Field type float.
    TYPE_FLOAT = 2

    # Field type int64.
    TYPE_INT64 = 3

    # Field type uint64.
    TYPE_UINT64 = 4

    # Field type int32.
    TYPE_INT32 = 5

    # Field type fixed64.
    TYPE_FIXED64 = 6

    # Field type fixed32.
    TYPE_FIXED32 = 7

    # Field type bool.
    TYPE_BOOL = 8

    # Field type string.
    TYPE_STRING = 9

    # Field type group. Proto2 syntax only, and deprecated.
    TYPE_GROUP = 10

    # Field type message.
    TYPE_MESSAGE = 11

    # Field type bytes.
    TYPE_BYTES = 12

    # Field type uint32.
    TYPE_UINT32 = 13

    # Field type enum.
    TYPE_ENUM = 14

    # Field type sfixed32.
    TYPE_SFIXED32 = 15

    # Field type sfixed64.
    TYPE_SFIXED64 = 16

    # Field type sint32.
    TYPE_SINT32 = 17

    # Field type sint64.
    TYPE_SINT64 = 18
  end

  # Whether a field is optional, required, or repeated.
  module Cardinality
    # For fields with unknown cardinality.
    CARDINALITY_UNKNOWN = 0

    # For optional fields.
    CARDINALITY_OPTIONAL = 1

    # For required fields. Proto2 syntax only.
    CARDINALITY_REQUIRED = 2

    # For repeated fields.
    CARDINALITY_REPEATED = 3
  end
end

#json_name::String

Returns The field JSON name.

Returns:

  • (::String)

    The field JSON name.



82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
# File 'proto_docs/google/protobuf/type.rb', line 82

class Field
  include ::Google::Protobuf::MessageExts
  extend ::Google::Protobuf::MessageExts::ClassMethods

  # Basic field types.
  module Kind
    # Field type unknown.
    TYPE_UNKNOWN = 0

    # Field type double.
    TYPE_DOUBLE = 1

    # Field type float.
    TYPE_FLOAT = 2

    # Field type int64.
    TYPE_INT64 = 3

    # Field type uint64.
    TYPE_UINT64 = 4

    # Field type int32.
    TYPE_INT32 = 5

    # Field type fixed64.
    TYPE_FIXED64 = 6

    # Field type fixed32.
    TYPE_FIXED32 = 7

    # Field type bool.
    TYPE_BOOL = 8

    # Field type string.
    TYPE_STRING = 9

    # Field type group. Proto2 syntax only, and deprecated.
    TYPE_GROUP = 10

    # Field type message.
    TYPE_MESSAGE = 11

    # Field type bytes.
    TYPE_BYTES = 12

    # Field type uint32.
    TYPE_UINT32 = 13

    # Field type enum.
    TYPE_ENUM = 14

    # Field type sfixed32.
    TYPE_SFIXED32 = 15

    # Field type sfixed64.
    TYPE_SFIXED64 = 16

    # Field type sint32.
    TYPE_SINT32 = 17

    # Field type sint64.
    TYPE_SINT64 = 18
  end

  # Whether a field is optional, required, or repeated.
  module Cardinality
    # For fields with unknown cardinality.
    CARDINALITY_UNKNOWN = 0

    # For optional fields.
    CARDINALITY_OPTIONAL = 1

    # For required fields. Proto2 syntax only.
    CARDINALITY_REQUIRED = 2

    # For repeated fields.
    CARDINALITY_REPEATED = 3
  end
end

#kind::Google::Protobuf::Field::Kind

Returns The field type.

Returns:



82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
# File 'proto_docs/google/protobuf/type.rb', line 82

class Field
  include ::Google::Protobuf::MessageExts
  extend ::Google::Protobuf::MessageExts::ClassMethods

  # Basic field types.
  module Kind
    # Field type unknown.
    TYPE_UNKNOWN = 0

    # Field type double.
    TYPE_DOUBLE = 1

    # Field type float.
    TYPE_FLOAT = 2

    # Field type int64.
    TYPE_INT64 = 3

    # Field type uint64.
    TYPE_UINT64 = 4

    # Field type int32.
    TYPE_INT32 = 5

    # Field type fixed64.
    TYPE_FIXED64 = 6

    # Field type fixed32.
    TYPE_FIXED32 = 7

    # Field type bool.
    TYPE_BOOL = 8

    # Field type string.
    TYPE_STRING = 9

    # Field type group. Proto2 syntax only, and deprecated.
    TYPE_GROUP = 10

    # Field type message.
    TYPE_MESSAGE = 11

    # Field type bytes.
    TYPE_BYTES = 12

    # Field type uint32.
    TYPE_UINT32 = 13

    # Field type enum.
    TYPE_ENUM = 14

    # Field type sfixed32.
    TYPE_SFIXED32 = 15

    # Field type sfixed64.
    TYPE_SFIXED64 = 16

    # Field type sint32.
    TYPE_SINT32 = 17

    # Field type sint64.
    TYPE_SINT64 = 18
  end

  # Whether a field is optional, required, or repeated.
  module Cardinality
    # For fields with unknown cardinality.
    CARDINALITY_UNKNOWN = 0

    # For optional fields.
    CARDINALITY_OPTIONAL = 1

    # For required fields. Proto2 syntax only.
    CARDINALITY_REQUIRED = 2

    # For repeated fields.
    CARDINALITY_REPEATED = 3
  end
end

#name::String

Returns The field name.

Returns:

  • (::String)

    The field name.



82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
# File 'proto_docs/google/protobuf/type.rb', line 82

class Field
  include ::Google::Protobuf::MessageExts
  extend ::Google::Protobuf::MessageExts::ClassMethods

  # Basic field types.
  module Kind
    # Field type unknown.
    TYPE_UNKNOWN = 0

    # Field type double.
    TYPE_DOUBLE = 1

    # Field type float.
    TYPE_FLOAT = 2

    # Field type int64.
    TYPE_INT64 = 3

    # Field type uint64.
    TYPE_UINT64 = 4

    # Field type int32.
    TYPE_INT32 = 5

    # Field type fixed64.
    TYPE_FIXED64 = 6

    # Field type fixed32.
    TYPE_FIXED32 = 7

    # Field type bool.
    TYPE_BOOL = 8

    # Field type string.
    TYPE_STRING = 9

    # Field type group. Proto2 syntax only, and deprecated.
    TYPE_GROUP = 10

    # Field type message.
    TYPE_MESSAGE = 11

    # Field type bytes.
    TYPE_BYTES = 12

    # Field type uint32.
    TYPE_UINT32 = 13

    # Field type enum.
    TYPE_ENUM = 14

    # Field type sfixed32.
    TYPE_SFIXED32 = 15

    # Field type sfixed64.
    TYPE_SFIXED64 = 16

    # Field type sint32.
    TYPE_SINT32 = 17

    # Field type sint64.
    TYPE_SINT64 = 18
  end

  # Whether a field is optional, required, or repeated.
  module Cardinality
    # For fields with unknown cardinality.
    CARDINALITY_UNKNOWN = 0

    # For optional fields.
    CARDINALITY_OPTIONAL = 1

    # For required fields. Proto2 syntax only.
    CARDINALITY_REQUIRED = 2

    # For repeated fields.
    CARDINALITY_REPEATED = 3
  end
end

#number::Integer

Returns The field number.

Returns:

  • (::Integer)

    The field number.



82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
# File 'proto_docs/google/protobuf/type.rb', line 82

class Field
  include ::Google::Protobuf::MessageExts
  extend ::Google::Protobuf::MessageExts::ClassMethods

  # Basic field types.
  module Kind
    # Field type unknown.
    TYPE_UNKNOWN = 0

    # Field type double.
    TYPE_DOUBLE = 1

    # Field type float.
    TYPE_FLOAT = 2

    # Field type int64.
    TYPE_INT64 = 3

    # Field type uint64.
    TYPE_UINT64 = 4

    # Field type int32.
    TYPE_INT32 = 5

    # Field type fixed64.
    TYPE_FIXED64 = 6

    # Field type fixed32.
    TYPE_FIXED32 = 7

    # Field type bool.
    TYPE_BOOL = 8

    # Field type string.
    TYPE_STRING = 9

    # Field type group. Proto2 syntax only, and deprecated.
    TYPE_GROUP = 10

    # Field type message.
    TYPE_MESSAGE = 11

    # Field type bytes.
    TYPE_BYTES = 12

    # Field type uint32.
    TYPE_UINT32 = 13

    # Field type enum.
    TYPE_ENUM = 14

    # Field type sfixed32.
    TYPE_SFIXED32 = 15

    # Field type sfixed64.
    TYPE_SFIXED64 = 16

    # Field type sint32.
    TYPE_SINT32 = 17

    # Field type sint64.
    TYPE_SINT64 = 18
  end

  # Whether a field is optional, required, or repeated.
  module Cardinality
    # For fields with unknown cardinality.
    CARDINALITY_UNKNOWN = 0

    # For optional fields.
    CARDINALITY_OPTIONAL = 1

    # For required fields. Proto2 syntax only.
    CARDINALITY_REQUIRED = 2

    # For repeated fields.
    CARDINALITY_REPEATED = 3
  end
end

#oneof_index::Integer

Returns The index of the field type in Type.oneofs, for message or enumeration types. The first type has index 1; zero means the type is not in the list.

Returns:

  • (::Integer)

    The index of the field type in Type.oneofs, for message or enumeration types. The first type has index 1; zero means the type is not in the list.



82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
# File 'proto_docs/google/protobuf/type.rb', line 82

class Field
  include ::Google::Protobuf::MessageExts
  extend ::Google::Protobuf::MessageExts::ClassMethods

  # Basic field types.
  module Kind
    # Field type unknown.
    TYPE_UNKNOWN = 0

    # Field type double.
    TYPE_DOUBLE = 1

    # Field type float.
    TYPE_FLOAT = 2

    # Field type int64.
    TYPE_INT64 = 3

    # Field type uint64.
    TYPE_UINT64 = 4

    # Field type int32.
    TYPE_INT32 = 5

    # Field type fixed64.
    TYPE_FIXED64 = 6

    # Field type fixed32.
    TYPE_FIXED32 = 7

    # Field type bool.
    TYPE_BOOL = 8

    # Field type string.
    TYPE_STRING = 9

    # Field type group. Proto2 syntax only, and deprecated.
    TYPE_GROUP = 10

    # Field type message.
    TYPE_MESSAGE = 11

    # Field type bytes.
    TYPE_BYTES = 12

    # Field type uint32.
    TYPE_UINT32 = 13

    # Field type enum.
    TYPE_ENUM = 14

    # Field type sfixed32.
    TYPE_SFIXED32 = 15

    # Field type sfixed64.
    TYPE_SFIXED64 = 16

    # Field type sint32.
    TYPE_SINT32 = 17

    # Field type sint64.
    TYPE_SINT64 = 18
  end

  # Whether a field is optional, required, or repeated.
  module Cardinality
    # For fields with unknown cardinality.
    CARDINALITY_UNKNOWN = 0

    # For optional fields.
    CARDINALITY_OPTIONAL = 1

    # For required fields. Proto2 syntax only.
    CARDINALITY_REQUIRED = 2

    # For repeated fields.
    CARDINALITY_REPEATED = 3
  end
end

#options::Array<::Google::Protobuf::Option>

Returns The protocol buffer options.

Returns:



82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
# File 'proto_docs/google/protobuf/type.rb', line 82

class Field
  include ::Google::Protobuf::MessageExts
  extend ::Google::Protobuf::MessageExts::ClassMethods

  # Basic field types.
  module Kind
    # Field type unknown.
    TYPE_UNKNOWN = 0

    # Field type double.
    TYPE_DOUBLE = 1

    # Field type float.
    TYPE_FLOAT = 2

    # Field type int64.
    TYPE_INT64 = 3

    # Field type uint64.
    TYPE_UINT64 = 4

    # Field type int32.
    TYPE_INT32 = 5

    # Field type fixed64.
    TYPE_FIXED64 = 6

    # Field type fixed32.
    TYPE_FIXED32 = 7

    # Field type bool.
    TYPE_BOOL = 8

    # Field type string.
    TYPE_STRING = 9

    # Field type group. Proto2 syntax only, and deprecated.
    TYPE_GROUP = 10

    # Field type message.
    TYPE_MESSAGE = 11

    # Field type bytes.
    TYPE_BYTES = 12

    # Field type uint32.
    TYPE_UINT32 = 13

    # Field type enum.
    TYPE_ENUM = 14

    # Field type sfixed32.
    TYPE_SFIXED32 = 15

    # Field type sfixed64.
    TYPE_SFIXED64 = 16

    # Field type sint32.
    TYPE_SINT32 = 17

    # Field type sint64.
    TYPE_SINT64 = 18
  end

  # Whether a field is optional, required, or repeated.
  module Cardinality
    # For fields with unknown cardinality.
    CARDINALITY_UNKNOWN = 0

    # For optional fields.
    CARDINALITY_OPTIONAL = 1

    # For required fields. Proto2 syntax only.
    CARDINALITY_REQUIRED = 2

    # For repeated fields.
    CARDINALITY_REPEATED = 3
  end
end

#packed::Boolean

Returns Whether to use alternative packed wire representation.

Returns:

  • (::Boolean)

    Whether to use alternative packed wire representation.



82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
# File 'proto_docs/google/protobuf/type.rb', line 82

class Field
  include ::Google::Protobuf::MessageExts
  extend ::Google::Protobuf::MessageExts::ClassMethods

  # Basic field types.
  module Kind
    # Field type unknown.
    TYPE_UNKNOWN = 0

    # Field type double.
    TYPE_DOUBLE = 1

    # Field type float.
    TYPE_FLOAT = 2

    # Field type int64.
    TYPE_INT64 = 3

    # Field type uint64.
    TYPE_UINT64 = 4

    # Field type int32.
    TYPE_INT32 = 5

    # Field type fixed64.
    TYPE_FIXED64 = 6

    # Field type fixed32.
    TYPE_FIXED32 = 7

    # Field type bool.
    TYPE_BOOL = 8

    # Field type string.
    TYPE_STRING = 9

    # Field type group. Proto2 syntax only, and deprecated.
    TYPE_GROUP = 10

    # Field type message.
    TYPE_MESSAGE = 11

    # Field type bytes.
    TYPE_BYTES = 12

    # Field type uint32.
    TYPE_UINT32 = 13

    # Field type enum.
    TYPE_ENUM = 14

    # Field type sfixed32.
    TYPE_SFIXED32 = 15

    # Field type sfixed64.
    TYPE_SFIXED64 = 16

    # Field type sint32.
    TYPE_SINT32 = 17

    # Field type sint64.
    TYPE_SINT64 = 18
  end

  # Whether a field is optional, required, or repeated.
  module Cardinality
    # For fields with unknown cardinality.
    CARDINALITY_UNKNOWN = 0

    # For optional fields.
    CARDINALITY_OPTIONAL = 1

    # For required fields. Proto2 syntax only.
    CARDINALITY_REQUIRED = 2

    # For repeated fields.
    CARDINALITY_REPEATED = 3
  end
end

#type_url::String

Returns The field type URL, without the scheme, for message or enumeration types. Example: "type.googleapis.com/google.protobuf.Timestamp".

Returns:

  • (::String)

    The field type URL, without the scheme, for message or enumeration types. Example: "type.googleapis.com/google.protobuf.Timestamp".



82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
# File 'proto_docs/google/protobuf/type.rb', line 82

class Field
  include ::Google::Protobuf::MessageExts
  extend ::Google::Protobuf::MessageExts::ClassMethods

  # Basic field types.
  module Kind
    # Field type unknown.
    TYPE_UNKNOWN = 0

    # Field type double.
    TYPE_DOUBLE = 1

    # Field type float.
    TYPE_FLOAT = 2

    # Field type int64.
    TYPE_INT64 = 3

    # Field type uint64.
    TYPE_UINT64 = 4

    # Field type int32.
    TYPE_INT32 = 5

    # Field type fixed64.
    TYPE_FIXED64 = 6

    # Field type fixed32.
    TYPE_FIXED32 = 7

    # Field type bool.
    TYPE_BOOL = 8

    # Field type string.
    TYPE_STRING = 9

    # Field type group. Proto2 syntax only, and deprecated.
    TYPE_GROUP = 10

    # Field type message.
    TYPE_MESSAGE = 11

    # Field type bytes.
    TYPE_BYTES = 12

    # Field type uint32.
    TYPE_UINT32 = 13

    # Field type enum.
    TYPE_ENUM = 14

    # Field type sfixed32.
    TYPE_SFIXED32 = 15

    # Field type sfixed64.
    TYPE_SFIXED64 = 16

    # Field type sint32.
    TYPE_SINT32 = 17

    # Field type sint64.
    TYPE_SINT64 = 18
  end

  # Whether a field is optional, required, or repeated.
  module Cardinality
    # For fields with unknown cardinality.
    CARDINALITY_UNKNOWN = 0

    # For optional fields.
    CARDINALITY_OPTIONAL = 1

    # For required fields. Proto2 syntax only.
    CARDINALITY_REQUIRED = 2

    # For repeated fields.
    CARDINALITY_REPEATED = 3
  end
end