* made changes to java reflection * removed redundant method makeSound in Animal abstract class * added project for play-framework article
17 lines
498 B
Java
17 lines
498 B
Java
package util;
|
|
import com.fasterxml.jackson.databind.node.ObjectNode;
|
|
import play.libs.Json;
|
|
import play.libs.Json.*;
|
|
import com.fasterxml.jackson.databind.JsonNode;
|
|
|
|
public class Util{
|
|
public static ObjectNode createResponse(Object response,boolean ok){
|
|
ObjectNode result = Json.newObject();
|
|
result.put("isSuccessfull", ok);
|
|
if(response instanceof String)
|
|
result.put("body",(String)response);
|
|
else result.put("body",(JsonNode)response);
|
|
|
|
return result;
|
|
}
|
|
} |