Java tutorial
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package com.tamnd.app.rest.resources; import com.fasterxml.jackson.annotation.JsonIgnore; import com.tamnd.app.core.entities.Account; import com.tamnd.app.core.entities.AccountRole; import java.util.Set; import org.springframework.hateoas.ResourceSupport; /** * * @author tamnd */ public class AccountResource extends ResourceSupport { private Integer rid; private String userName; private String password; private Set<AccountRole> roles; public Account toAccount() { Account account = new Account(); account.setUserName(userName); account.setPassword(password); account.setEnable(Boolean.TRUE); account.setUserRole(getRoles()); return account; } /** * @return the rid */ public Integer getRid() { return rid; } /** * @param rid the rid to set */ public void setRid(Integer rid) { this.rid = rid; } /** * @return the userName */ public String getUserName() { return userName; } /** * @param userName the userName to set */ public void setUserName(String userName) { this.userName = userName; } /** * @return the password */ // @JsonIgnore public String getPassword() { return password; } /** * @param password the password to set */ // @JsonProperty public void setPassword(String password) { this.password = password; } /** * @return the roles */ public Set<AccountRole> getRoles() { return roles; } /** * @param roles the roles to set */ public void setRoles(Set<AccountRole> roles) { this.roles = roles; } }