converters.PatientConverter.java Source code

Java tutorial

Introduction

Here is the source code for converters.PatientConverter.java

Source

/*
 * 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 converters;

import domain.Patient;
import org.springframework.beans.factory.annotation.Autowired;
import service.DatabaseFacade;
import org.springframework.core.convert.converter.Converter;

/**
 *
 * @author Eline
 */
public class PatientConverter implements Converter<String, Patient> {

    @Autowired
    private DatabaseFacade service;

    @Override
    public Patient convert(String id) {
        return service.getPatientOnId(Long.valueOf(id));
    }

}