Class: Thrift::Types::Constant_definition::ConstantValueDefinition

Inherits:
Union
  • Object
show all
Includes:
Struct_Union
Defined in:
lib/thrift/types/constant_definition/constant_definition_types.rb,
lib/thrift/types/constant_definition/constant_definition_types.rb

Constant Summary collapse

NAME =
'ConstantValueDefinition'.freeze
NAMESPACE =
'types.constant_definition'.freeze
LEGACY_ANNOTATIONS =
{
}.freeze
STRUCTURED_ANNOTATIONS =
[
].freeze
THRIFT_FIELD_INDEX_REFERENCE =
1
THRIFT_FIELD_INDEX_INTEGER_VALUE =
2
THRIFT_FIELD_INDEX_DOUBLE_VALUE =
3
THRIFT_FIELD_INDEX_BOOL_VALUE =
4
THRIFT_FIELD_INDEX_STRING_VALUE =
5
THRIFT_FIELD_INDEX_LIST_VALUE =
6
THRIFT_FIELD_INDEX_MAP_VALUE =
7
THRIFT_FIELD_REFERENCE_LEGACY_ANNOTATIONS =
{
}.freeze
THRIFT_FIELD_REFERENCE_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_STRING_VALUE_LEGACY_ANNOTATIONS =
{
}.freeze
THRIFT_FIELD_STRING_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
FIELDS =
{
  THRIFT_FIELD_INDEX_REFERENCE => {type: ::Thrift::Types::STRUCT, name: 'reference', class: ::Thrift::Thrift::Types::Core::Reference, optional: true, legacy_annotations: THRIFT_FIELD_REFERENCE_LEGACY_ANNOTATIONS, structured_annotations: THRIFT_FIELD_REFERENCE_STRUCTURED_ANNOTATIONS},
  THRIFT_FIELD_INDEX_INTEGER_VALUE => {type: ::Thrift::Types::I64, name: 'integer_value', optional: true, 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', optional: true, 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', optional: true, legacy_annotations: THRIFT_FIELD_BOOL_VALUE_LEGACY_ANNOTATIONS, structured_annotations: THRIFT_FIELD_BOOL_VALUE_STRUCTURED_ANNOTATIONS},
  THRIFT_FIELD_INDEX_STRING_VALUE => {type: ::Thrift::Types::STRING, name: 'string_value', optional: true, legacy_annotations: THRIFT_FIELD_STRING_VALUE_LEGACY_ANNOTATIONS, structured_annotations: THRIFT_FIELD_STRING_VALUE_STRUCTURED_ANNOTATIONS},
  THRIFT_FIELD_INDEX_LIST_VALUE => {type: ::Thrift::Types::STRUCT, name: 'list_value', class: ::Thrift::Types::Constant_definition::ListConstantValueDefinition, optional: true, 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::Constant_definition::MapConstantValueDefinition, optional: true, legacy_annotations: THRIFT_FIELD_MAP_VALUE_LEGACY_ANNOTATIONS, structured_annotations: THRIFT_FIELD_MAP_VALUE_STRUCTURED_ANNOTATIONS}
}.freeze

Constants included from Struct_Union

Struct_Union::CONTAINER_TYPES

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Struct_Union

#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

#<=>, #==, 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

.bool_value(val) ⇒ Object



161
162
163
# File 'lib/thrift/types/constant_definition/constant_definition_types.rb', line 161

def bool_value(val)
  ConstantValueDefinition.new(:bool_value, val)
end

.double_value(val) ⇒ Object



157
158
159
# File 'lib/thrift/types/constant_definition/constant_definition_types.rb', line 157

def double_value(val)
  ConstantValueDefinition.new(:double_value, val)
end

.integer_value(val) ⇒ Object



153
154
155
# File 'lib/thrift/types/constant_definition/constant_definition_types.rb', line 153

def integer_value(val)
  ConstantValueDefinition.new(:integer_value, val)
end

.list_value(val) ⇒ Object



169
170
171
# File 'lib/thrift/types/constant_definition/constant_definition_types.rb', line 169

def list_value(val)
  ConstantValueDefinition.new(:list_value, val)
end

.map_value(val) ⇒ Object



173
174
175
# File 'lib/thrift/types/constant_definition/constant_definition_types.rb', line 173

def map_value(val)
  ConstantValueDefinition.new(:map_value, val)
end

.reference(val) ⇒ Object



149
150
151
# File 'lib/thrift/types/constant_definition/constant_definition_types.rb', line 149

def reference(val)
  ConstantValueDefinition.new(:reference, val)
end

.string_value(val) ⇒ Object



165
166
167
# File 'lib/thrift/types/constant_definition/constant_definition_types.rb', line 165

def string_value(val)
  ConstantValueDefinition.new(:string_value, val)
end

Instance Method Details

#struct_fieldsObject



238
# File 'lib/thrift/types/constant_definition/constant_definition_types.rb', line 238

def struct_fields; FIELDS; end

#validateObject

Raises:

  • (StandardError)


240
241
242
# File 'lib/thrift/types/constant_definition/constant_definition_types.rb', line 240

def validate
  raise(StandardError, 'Union fields are not set.') if get_set_field.nil? || get_value.nil?
end