title: How to get thrift type of an attribute?
body: <p>I would like to process many attributes automatically.
  But my data are read from a file and they are string type...
  I would like to know if there is a solution to know the type of attribute.
  Thanks to this, I'll be able to convert string into the right type.</p>
  
  <pre><code>struct Test{
  1: i32 id,
  2: string name,
  3: Enumeration genre
  }
  
  test = Test.new
  </code></pre>
  
  <p>A method which does (for example) :</p>
  
  <pre><code>puts test.id.type  =&gt; Give me i32
  puts test.name.type  =&gt; Give me string
  </code></pre>
  
  <p>Etc..</p>
  
  <p>I can use test.id.class but it doesn't work .. (it tells me nilClass when it isn't assigned)</p>
  
  <p>And even if "id" is a i32,</p>
  
  <pre><code>test.id = "blabla"  =&gt; works... (normally, it shouldn't)
  </code></pre>
  
  <p>The verification of type is done only when you try to serialize... not when you assign a value into a thrift object.</p>
  
  <p>Thank you !</p>