title: Getting actual type of Option[Any]
body: <p>I have the following code:</p>
  
  <pre><code>case class Property(name: String, value: Option[Any])
  
  class PropertyType[+T &lt;: Any: ru.TypeTag] {
    def isValidType(property: Property): Boolean = {
      property.value match {
        case None =&gt; true
        case Some(value) =&gt; ru.typeOf[T] == getTypeTag(value)
      }
    }
  
    private def getTypeTag[TT: ru.TypeTag](obj: TT) = ru.typeTag[TT]
  }
  
  case object StringPropertyType extends PropertyType[String] 
  </code></pre>
  
  <p>Of course, StringPropertyType.isValidType(Property("test", Some("test))) returns false, because getTypeTag(Property.value.get) returns Any.</p>
  
  <p>I wonder how I could make it works, because getClass on value returns String:</p>
  
  <pre><code>scala&gt; Property("test", Some("test")).value.get.getClass
  res4: Class[_] = class java.lang.String
  </code></pre>
  
  <p>How can i get the actual value type of Option[Any].get? </p>