2

Since PlayFramework doesn't seem to allow primitive java types (e.g int, long) in routes, I've had to resort to using Integer in the routes, e.g:

GET /paginate/:page controllers.Foo.paginate(page: Integer)

However, when starting the app, I get a ton of warnings saying:

[warn] /project/target/scala-2.9.1/src_managed/main/routes_reverseRouting.scala:351: type Integer is deprecated: use java.lang.Integer instead
[warn] def paginate(page:Integer) = new play.api.mvc.HandlerRef(

Wtf is this about? Do I now have to specify java.lang.Integer in all my routes? Or am I missing something?

6
  • Have you tried to use Int instead? Commented Feb 16, 2013 at 2:11
  • What specific version of play? Did you try Int? Commented Feb 16, 2013 at 2:12
  • 2.0.4. No, I haven't tried Int. Is that a native java type or scala / play specific? Commented Feb 16, 2013 at 2:14
  • Int, a 32-bit signed integer (equivalent to Java's int primitive type). Reference here scala-lang.org/api/current/index.html#scala.Int Commented Feb 16, 2013 at 2:17
  • 3
    stackoverflow.com/questions/1269170/… gives good explanation. Commented Feb 16, 2013 at 2:20

1 Answer 1

3

1) In the routes file: replace "Integer" with "Int". You may want to specify a default value. Example:

GET  /my/path  controllers.MyController.foo(value:Int ?= 0)

2) In the (Java) controller: change Integer to int

public static Result foo(int value) {}

I found the warning "type Integer is deprecated: use java.lang.Integer instead" very confusing too.

Sign up to request clarification or add additional context in comments.

1 Comment

Thank you man, your answer help us, i do not know more about scala but i love Play Framework.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.