1

Is there a way to use Java8's Optional in a Jersey application?

If you have a Pojo

public class Test {
    String id;
    Optional<String> message;

    // getters and setters 
}

Could I then use that Test class in a controller like so:

@POST
public Response save(Test test) {
    test.message.isPresent()...
    return Response.build();
}

0 Answers0