NSF
NSF

Reputation: 2549

How to construct the Scala Form using a Java class in Play

I have a Java class like:

public class User {
   public String name;
   public String email;
}

Instead of creating another case class in Scala or using tuple, can I do something like

Form<User> form = Form.form(User.class)

The above code is possible in Play Java but not for Scala

Upvotes: 2

Views: 519

Answers (1)

Luigi Plinge
Luigi Plinge

Reputation: 51109

.class isn't a keyword in Scala. Try classOf[User].

i.e.

val form = Form.form(classOf[User])

Upvotes: 2

Related Questions