我有一个元组
val tuple = ("Mike", 40)
Run Code Online (Sandbox Code Playgroud)
和一个案例类
case class Person(name: String, age: Int)
Run Code Online (Sandbox Code Playgroud)
如何将我的元组打包到Person类的对象?除此之外有什么方法:
new Person(tuple._1, tuple._2)
Run Code Online (Sandbox Code Playgroud)
也许有人喜欢
tuple.asInstanceOf[Person]
Run Code Online (Sandbox Code Playgroud)
谢谢.
我有一个实体(使用lombok)和一些带注释的@JsonView注释.
@Entity
@Table(name = "`order`")
@Getter
@Setter
@ToString
@Description("??????")
public class Order extends Auditable {
private static final long serialVersionUID = -1299630493411381582L;
@JsonView(JsonViews.OrderAdvancedSearch.class)
@ManyToOne
private School school;
@Column(length = 50)
private String number;
}
Run Code Online (Sandbox Code Playgroud)
有一个用@JsonView注释注释的控制器方法.
@Secured(value = {"ROLE_AUTHENTICATED_USER"})
@RequestMapping(value = "/order", method = RequestMethod.GET, headers = {"Content-Type=application/json"})
@JsonView(JsonViews.OrderAdvancedSearch.class)
@ResponseBody
public ResponseEntity<Order> getOrder(HttpServletRequest request) throws IOException, DnevnikException, RestException {
Order order = orderRepository.findOne(292L); // just for example
return new ResponseEntity<>(order,HttpStatus.OK);
}
Run Code Online (Sandbox Code Playgroud)
我希望输入只包含用@JsonView注释的字段.但我充满了田野.
我正在尝试调试spring和jackson来源.在com.fasterxml.jackson.databind.SerializationConfig中,我看到活动视图是我的类JsonViews.OrderAdvancedSearch.class但是在com.fasterxml.jackson.databind.ser.std.BeanSerializerBase变量中,filteredProps始终具有我的实体的所有属性.
我对速度测试和我的应用程序的性能感兴趣.例如,数据库查询花了多少时间(我使用squeryl ORM).
是否有Intellij-Idea IDE的插件?
我有REST方法来更新用户个人资料。如果某些参数无效,系统应返回哪个状态码?或者,例如,如果旧密码和DB中的密码不相等,则更改密码。400错误的请求?
我正在尝试为spring @RequestMapping注释创建值属性,以便像这样映射url
/educationDistrict/308/action/resetAddressesForYear/1
Run Code Online (Sandbox Code Playgroud)
还有这个
/educationDistrict/308/action/resetAddressesForYear
Run Code Online (Sandbox Code Playgroud)
我有这个
@RequestMapping(value = "/{repository}/{id}/action/{methodName:[A-z]*}{v:.*}", method = RequestMethod.POST)
Run Code Online (Sandbox Code Playgroud)
但第一个网址不匹配.
我不能使用多重值因为春天hateoas https://github.com/spring-projects/spring-hateoas/issues/186
春天4.1.5
如何在树莓派3上运行apache mesos?我应该自己构建它还是有任何用于raspbian的软件包?我找不到任何新鲜的教程。
scala ×2
spring ×2
jackson ×1
java ×1
json ×1
json-view ×1
mesos ×1
mesosphere ×1
rest ×1
spring-mvc ×1