com.editor.EmployeeEditor.java Source code

Java tutorial

Introduction

Here is the source code for com.editor.EmployeeEditor.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 com.editor;

import com.model.Employee;
import com.service.EmployeeService;
import java.beans.PropertyEditorSupport;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 *
 * @author Angela
 */
@Component
public class EmployeeEditor extends PropertyEditorSupport {
    @Autowired
    private EmployeeService employeeService;

    @Override
    public void setAsText(String text) {
        Employee employee = this.employeeService.getEmployee(Integer.valueOf(text));
        this.setValue(employee);
    }
}