score:0
Figured it out.
Just needed to use m.typeSignature
for (m <- typeOf[Account].members.filter(m => !m.isMethod)) {
| println(m)
| println(m.typeSignature)
| }
variable accountNumber
String
variable name
String
score:8
You can use typeSignature
:
scala> typeOf[Account].members.filter(!_.isMethod).foreach(
| sym => println(sym + " is a " + sym.typeSignature)
| )
variable accountNumber is a String
variable name is a String
In this context this method will return a reflect.runtime.universe.Type
.
Source: stackoverflow.com
Related Query
- Scala - how to get the 'type' for a field using reflection api
- How the get the classOf for a scala object type
- How to make Reflection for getting the field value by its string name and its original type
- How to get the proper return type when using a filter based on type in Scala
- How do you check if a runtime instance conforms to some type using the Scala 2.10 reflection API?
- In Scala, how to use reflection to get the real type of varargs parameters for method
- Get type of primitive field from an object using Scala reflection
- How to get underlying constant type from singleton type with Scala reflection API
- How do I write a query for mongodb using the casbah driver for scala that uses a substring and checks if the field is in a list of supplied values?
- How to get the type of a field using reflection?
- How to use scala reflection API to get all contained classes
- How to get the name of a case class field as a string/symbol at compile time using shapeless?
- Get all the classes that implements a trait in Scala using reflection
- Using Scala 2.10 reflection how can I list the values of Enumeration?
- Get the companion object instance of a inner modul with the Scala reflection API
- How can I use the new reflection API to tell if the component type of an array conforms to a type parameter?
- How to select a object field for map value in Scala using groupby
- How do I get the runtime Class of a parameterized Type in a Scala trait
- Type equality in the Scala 2.10 Reflection API
- How to ask for the same type in Scala generics without introducing a third type parameter?
- How can I get random data generated for scala case classes with the ability to "change some values" for unit testing?
- In scala macros, how to get the complete `extends` clause for a class?
- Scala 2.10 reflection: Why do I get the same type "List()" for the list and list element?
- Is it possible to use reflection to find the actual type of a field declared to be a Scala Enumeration subtype?
- How to see the type of a scala variable? For instance a Spark PairRDD
- How to to get an object out of a HashMap without using the Java Reflection API?
- How to get the COUNT of emails for each id in Scala
- How to get return type string of a method using Scala reflection?
- How to get the set of rows which contains null values from dataframe in scala using filter
- Scala - how come using a super-type with two generic parameters cause the scala type checker to treat the child-type differently?
More Query from same tag
- Scala: how to add type-dependent methods in trait?
- Scala Sax parser unable to process <!DOCTYPE XML>
- Unable to create Kafka Producer Object in Intellij
- Merge multiple dataframes given within a foreach to one dataframe - Scala spark
- SBT / ScalaTest: Configurations already specified for module
- How to replace(fill) None entries on List of Options from another List using idiomatic Scala?
- Include scala classes in the sources jar generated by maven package
- Apache Spark Data Generator Function on Databricks Not working
- Scala akka typed: how to get ActorRef to Actor from it's instance and send message itself?
- Using race from cats-effect prevents app from exiting
- How to access one of multiple traits of superclass?
- How to manage concurrent users in Gatling?
- FlatSpec displays strange behaviour while using 'should contain only'
- In scala 2.13.6+ library, what are the purposes of automatically generated functions with `$extension` suffix?
- How to return a value of Right value of Either in Scala test
- Spray rest with webapp serving
- Apply custom schema to post response JSON from rest api using scala spark
- create Scalaz equal instance on class with subtypes
- Removing punctuation marks form text in Scala - Spark
- Spark DataFrame Zeppelin read folders
- Most efficient way to convert RDD[Status] to specific json
- scala spark rdd error : java.lang.ClassCastException: cannot assign instance of java.lang.invoke.SerializedLambda
- How to hold hexadecimal values in Scala?
- SPARK : How to create aggregate from RDD[Row] in Scala
- Maximum enclosing circle algorithm with Spark
- Python vs Scala (for Spark jobs)
- What is the idiomatic way to extend a class which has implicit parameters in the constructor in Scala?
- Sequentially group entries in a List in Scala
- overloaded method value async with alternatives:
- Per-configuration classpath dependencies doesn't work with test->test in SBT?