コード例 #1
0
  public static DepartmentResponse convertNameInfo(Department department) {
    DepartmentResponse result = new DepartmentResponse();
    result.setId(department.getId());
    result.setName(department.getName());
    result.setDescription(department.getDescription());

    return result;
  }
コード例 #2
0
  public static Department convert(DepartmentResponse department) {
    Department result = new Department();
    result.setId(department.getId());
    result.setName(department.getName());
    result.setDescription(department.getDescription());

    if (department.getDirector() != null) {
      result.setDirector(EmployeeResponseConverter.convert(department.getDirector()));
    }

    for (EmployeeResponse employeeResponse : department.getEmployees()) {
      result.addEmployee(EmployeeResponseConverter.convert(employeeResponse));
    }

    return result;
  }