title: Can I take a class as an argument to a macro annotation
body: <p>I'm attempting to build a scala class based on some java classes generated by a third party annotation pre-processor.</p>
  
  <p>I'd like to be able to "point" to a class from an annotated object, for example:</p>
  
  <pre><code>@MyAnnotation(classOf[GeneratedJavaClass]) object MyObject
  </code></pre>
  
  <p>or</p>
  
  <pre><code>@MyAnnotation object MyObject extends PlaceHolderTrait[GeneratedJavaClass]
  </code></pre>
  
  <p>Once I'm in the actual macro implementation, I would like to reflect on GeneratedJavaClass to find it's members which I'll use to build the implementation of MyObject</p>
  
  <p>My starting point so far is based on <a href="https://github.com/travisbrown/type-provider-examples/blob/master/rdfs-public/src/main/scala/public/PrefixGenerator.scala" rel="nofollow">https://github.com/travisbrown/type-provider-examples/blob/master/rdfs-public/src/main/scala/public/PrefixGenerator.scala</a>.</p>
  
  <p>I've tried to understand how I could take a Class[T] as the argument to the annotation and then match on <code>c.macroApplication</code> with <code>Apply(Select(Apply(_, List(TypeApply(_, List(catalog)))), _), _)</code> but the type I get is a <code>TypeApply(_, List(Trees$Ident)</code> and I don't see a way to get the class from there (I assume classOf[T] isn't a literal).</p>
  
  <p>As an alternative, I thought I'd try to extract the type I want from a trait that I have the object extend. I tried matching the annotee against <code>case List(q"object $name extends PlaceHolderTrait[$parent] { ..$body }")</code> but again end up with a Trees$Ident and am not sure how to get the class that is being referenced.</p>
  
  <p>I realize I could probably just pass a String of the fully qualified name and use reflection to get the class, but I was hoping for a nicer alternative. Note that I'm not tied to those 2 alternatives for specifying the class, they are just the 2 options I've been able to come up with.</p>