reflection - How do I check if a Scala HigherKinded TypeTag is an Array? -


I am trying to convert a type of tag to a Java client that usually creates a type of poll parameter There are some libraries that benefit from these conversions (like Jackson, and Gius). I am currently trying to insufficient the manifest code typeTag to the manifest s for some corner cases.

JVM considers the array special to be compared to other data types. The difference between classOf [int] and classOf [Array [int]] is that the true return for method Class.isArray () Will come later

Clear implementation was simple. manifest.erasure was a class example where isArray () was already valid / true.

TypeTag implementation is intriguing. There is no quick and easy deletion method is not exactly the same 'type' tag type, runtime mirror.Runtimeclass does not handle any array based classes on our behalf. Read the document:

Note: If the Scala symbol is ArrayClass, a ClassNotFound exception is thrown because there is no unique Java class related to Scala generic array

To work on this, I try to figure out that this is an array. If it's an array, then I manually make the class object. However, I have come in the case of an additional edge when Array has an unknown type of argument.

First let me show you an example that is not a high-volume type.

  import scala.frack.entum.inas.views.-class A [t] valial type = type [a [array [_]]] asInstanceOf [TypeRefApi] .args.head Inner type & lt ;: & lt; TypeOf [array [_]] // Returns is true.  

So far so good.

[b] [t [_]] type val type type [b [array]] asInstanceOf [TypeRefApi] Args.head's internal type

I can not make a type of [array] because it complains about the missing parameter. How can I find out that there is a type of array in B?

Besides, what does the example of class look like in this case? Is this an array [object]?

Re-decomposition:

  Scala> Entrepreneur Match {Case Typfer (ex, sim, args) = & gt; 


Comments

Popular posts from this blog

python - Overriding the save method in Django ModelForm -

html - CSS autoheight, but fit content to height of div -

qt - How to prevent QAudioInput from automatically boosting the master volume to 100%? -