Class: Thrift::Types::Value::Value
- Inherits:
-
Union
- Object
- Union
- Thrift::Types::Value::Value
show all
- Includes:
- Struct_Union
- Defined in:
- lib/thrift/types/value/value.rb,
lib/thrift/types/value/value_types.rb,
lib/thrift/types/value/value_types.rb
Constant Summary
collapse
- NAME =
'Value'.freeze
- NAMESPACE =
'types.value'.freeze
- LEGACY_ANNOTATIONS =
{
}.freeze
- STRUCTURED_ANNOTATIONS =
[
].freeze
- THRIFT_FIELD_INDEX_NULL_VALUE =
1
- THRIFT_FIELD_INDEX_STRING_VALUE =
2
- THRIFT_FIELD_INDEX_BINARY_VALUE =
3
- THRIFT_FIELD_INDEX_INTEGER_VALUE =
4
- THRIFT_FIELD_INDEX_DOUBLE_VALUE =
5
- THRIFT_FIELD_INDEX_BOOL_VALUE =
6
- THRIFT_FIELD_INDEX_LIST_VALUE =
7
- THRIFT_FIELD_INDEX_MAP_VALUE =
8
- THRIFT_FIELD_INDEX_STRUCT_VALUE =
9
- THRIFT_FIELD_NULL_VALUE_LEGACY_ANNOTATIONS =
{
}.freeze
- THRIFT_FIELD_NULL_VALUE_STRUCTURED_ANNOTATIONS =
[
].freeze
- THRIFT_FIELD_STRING_VALUE_LEGACY_ANNOTATIONS =
{
}.freeze
- THRIFT_FIELD_STRING_VALUE_STRUCTURED_ANNOTATIONS =
[
].freeze
- THRIFT_FIELD_BINARY_VALUE_LEGACY_ANNOTATIONS =
{
}.freeze
- THRIFT_FIELD_BINARY_VALUE_STRUCTURED_ANNOTATIONS =
[
].freeze
- THRIFT_FIELD_INTEGER_VALUE_LEGACY_ANNOTATIONS =
{
}.freeze
- THRIFT_FIELD_INTEGER_VALUE_STRUCTURED_ANNOTATIONS =
[
].freeze
- THRIFT_FIELD_DOUBLE_VALUE_LEGACY_ANNOTATIONS =
{
}.freeze
- THRIFT_FIELD_DOUBLE_VALUE_STRUCTURED_ANNOTATIONS =
[
].freeze
- THRIFT_FIELD_BOOL_VALUE_LEGACY_ANNOTATIONS =
{
}.freeze
- THRIFT_FIELD_BOOL_VALUE_STRUCTURED_ANNOTATIONS =
[
].freeze
- THRIFT_FIELD_LIST_VALUE_LEGACY_ANNOTATIONS =
{
}.freeze
- THRIFT_FIELD_LIST_VALUE_STRUCTURED_ANNOTATIONS =
[
].freeze
- THRIFT_FIELD_MAP_VALUE_LEGACY_ANNOTATIONS =
{
}.freeze
- THRIFT_FIELD_MAP_VALUE_STRUCTURED_ANNOTATIONS =
[
].freeze
- THRIFT_FIELD_STRUCT_VALUE_LEGACY_ANNOTATIONS =
{
}.freeze
- THRIFT_FIELD_STRUCT_VALUE_STRUCTURED_ANNOTATIONS =
[
].freeze
- FIELDS =
{
THRIFT_FIELD_INDEX_NULL_VALUE => {type: ::Thrift::Types::STRUCT, name: 'null_value', class: ::Thrift::Types::Value::NullValue, legacy_annotations: THRIFT_FIELD_NULL_VALUE_LEGACY_ANNOTATIONS, structured_annotations: THRIFT_FIELD_NULL_VALUE_STRUCTURED_ANNOTATIONS},
THRIFT_FIELD_INDEX_STRING_VALUE => {type: ::Thrift::Types::STRING, name: 'string_value', legacy_annotations: THRIFT_FIELD_STRING_VALUE_LEGACY_ANNOTATIONS, structured_annotations: THRIFT_FIELD_STRING_VALUE_STRUCTURED_ANNOTATIONS},
THRIFT_FIELD_INDEX_BINARY_VALUE => {type: ::Thrift::Types::STRING, name: 'binary_value', binary: true, legacy_annotations: THRIFT_FIELD_BINARY_VALUE_LEGACY_ANNOTATIONS, structured_annotations: THRIFT_FIELD_BINARY_VALUE_STRUCTURED_ANNOTATIONS},
THRIFT_FIELD_INDEX_INTEGER_VALUE => {type: ::Thrift::Types::I64, name: 'integer_value', legacy_annotations: THRIFT_FIELD_INTEGER_VALUE_LEGACY_ANNOTATIONS, structured_annotations: THRIFT_FIELD_INTEGER_VALUE_STRUCTURED_ANNOTATIONS},
THRIFT_FIELD_INDEX_DOUBLE_VALUE => {type: ::Thrift::Types::DOUBLE, name: 'double_value', legacy_annotations: THRIFT_FIELD_DOUBLE_VALUE_LEGACY_ANNOTATIONS, structured_annotations: THRIFT_FIELD_DOUBLE_VALUE_STRUCTURED_ANNOTATIONS},
THRIFT_FIELD_INDEX_BOOL_VALUE => {type: ::Thrift::Types::BOOL, name: 'bool_value', legacy_annotations: THRIFT_FIELD_BOOL_VALUE_LEGACY_ANNOTATIONS, structured_annotations: THRIFT_FIELD_BOOL_VALUE_STRUCTURED_ANNOTATIONS},
THRIFT_FIELD_INDEX_LIST_VALUE => {type: ::Thrift::Types::STRUCT, name: 'list_value', class: ::Thrift::Types::Value::ListValue, legacy_annotations: THRIFT_FIELD_LIST_VALUE_LEGACY_ANNOTATIONS, structured_annotations: THRIFT_FIELD_LIST_VALUE_STRUCTURED_ANNOTATIONS},
THRIFT_FIELD_INDEX_MAP_VALUE => {type: ::Thrift::Types::STRUCT, name: 'map_value', class: ::Thrift::Types::Value::MapValue, legacy_annotations: THRIFT_FIELD_MAP_VALUE_LEGACY_ANNOTATIONS, structured_annotations: THRIFT_FIELD_MAP_VALUE_STRUCTURED_ANNOTATIONS},
THRIFT_FIELD_INDEX_STRUCT_VALUE => {type: ::Thrift::Types::STRUCT, name: 'struct_value', class: ::Thrift::Types::Value::StructValue, legacy_annotations: THRIFT_FIELD_STRUCT_VALUE_LEGACY_ANNOTATIONS, structured_annotations: THRIFT_FIELD_STRUCT_VALUE_STRUCTURED_ANNOTATIONS}
}
Struct_Union::CONTAINER_TYPES
Class Method Summary
collapse
Instance Method Summary
collapse
#each_field, #field_info, #inspect_collection, #inspect_field, #is_container?, #name_to_id, #read_field, #sorted_field_ids, #write_container, #write_data
Methods inherited from Union
#<=>, #==, #eql?, field_accessor, generate_accessors, #get_set_field, #get_value, #hash, #initialize, #inspect, qmark_isset_method, #read, #write
Constructor Details
This class inherits a constructor from Thrift::Union
Class Method Details
.binary_value(val) ⇒ Object
216
217
218
|
# File 'lib/thrift/types/value/value_types.rb', line 216
def binary_value(val)
Value.new(:binary_value, val)
end
|
.bool_value(val) ⇒ Object
228
229
230
|
# File 'lib/thrift/types/value/value_types.rb', line 228
def bool_value(val)
Value.new(:bool_value, val)
end
|
.double_value(val) ⇒ Object
224
225
226
|
# File 'lib/thrift/types/value/value_types.rb', line 224
def double_value(val)
Value.new(:double_value, val)
end
|
.integer_value(val) ⇒ Object
220
221
222
|
# File 'lib/thrift/types/value/value_types.rb', line 220
def integer_value(val)
Value.new(:integer_value, val)
end
|
.list_value(val) ⇒ Object
232
233
234
|
# File 'lib/thrift/types/value/value_types.rb', line 232
def list_value(val)
Value.new(:list_value, val)
end
|
.map_value(val) ⇒ Object
236
237
238
|
# File 'lib/thrift/types/value/value_types.rb', line 236
def map_value(val)
Value.new(:map_value, val)
end
|
.null_value(val) ⇒ Object
208
209
210
|
# File 'lib/thrift/types/value/value_types.rb', line 208
def null_value(val)
Value.new(:null_value, val)
end
|
.string_value(val) ⇒ Object
212
213
214
|
# File 'lib/thrift/types/value/value_types.rb', line 212
def string_value(val)
Value.new(:string_value, val)
end
|
.struct_value(val) ⇒ Object
240
241
242
|
# File 'lib/thrift/types/value/value_types.rb', line 240
def struct_value(val)
Value.new(:struct_value, val)
end
|
Instance Method Details
#struct_fields ⇒ Object
321
|
# File 'lib/thrift/types/value/value_types.rb', line 321
def struct_fields; FIELDS; end
|
#to_object ⇒ Object
68
69
70
71
72
73
74
75
76
77
78
79
80
81
|
# File 'lib/thrift/types/value/value.rb', line 68
def to_object
case get_value.class
when NullValue
nil
when ListValue
list_value.to_array
when MapValue
map_value.to_hash
when StructValue
struct_value.to_hash
else
get_value
end
end
|
#validate ⇒ Object
323
324
325
|
# File 'lib/thrift/types/value/value_types.rb', line 323
def validate
raise(StandardError, 'Union fields are not set.') if get_set_field.nil? || get_value.nil?
end
|