Class: ContainerType

Inherits:
Object
  • Object
show all
Includes:
Thrift::Struct, Thrift::Struct_Union
Defined in:
lib/thrift/reflection_limited_types.rb

Constant Summary collapse

TTYPE =
1
SUBTYPE1 =
2
SUBTYPE2 =
3
FIELDS =
{
  TTYPE => {:type => ::Thrift::Types::I32, :name => 'ttype', :enum_class => TTypeTag},
  SUBTYPE1 => {:type => ::Thrift::Types::STRUCT, :name => 'subtype1', :class => SimpleType},
  SUBTYPE2 => {:type => ::Thrift::Types::STRUCT, :name => 'subtype2', :class => SimpleType, :optional => true}
}

Instance Method Summary collapse

Instance Method Details

#struct_fieldsObject



60
# File 'lib/thrift/reflection_limited_types.rb', line 60

def struct_fields; FIELDS; end

#validateObject



62
63
64
65
66
# File 'lib/thrift/reflection_limited_types.rb', line 62

def validate
  unless @ttype.nil? || TTypeTag::VALID_VALUES.include?(@ttype)
    raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Invalid value of field ttype!')
  end
end