- About Scala
- Documentation
- Code Examples
- Software
- Scala Developers
What is the Scala equivalent of Class.class in Java?
Sun, 2009-07-12, 19:52
Suppose I have a User class. What is the equivalent of Java's "User.class" in Scala?
The use case here is that I'm working with Google App Engine. A Query object can be created like this:
persistenceManager.newQuery(User.class)
I'm not sure how to do this in Scala. Trying the above gives an "Identifier expected but class found" error on compilation.
The use case here is that I'm working with Google App Engine. A Query object can be created like this:
persistenceManager.newQuery(User.class)
I'm not sure how to do this in Scala. Trying the above gives an "Identifier expected but class found" error on compilation.
classOf[User]
scala> class User;
defined class User
scala> classOf[User];
res0: java.lang.Class[User] = class User