com.editor.CompanyEditor.java Source code

Java tutorial

Introduction

Here is the source code for com.editor.CompanyEditor.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.Company;
import com.service.CompanyService;
import java.beans.PropertyEditorSupport;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 *
 * @author Dries
 */
@Component
public class CompanyEditor extends PropertyEditorSupport {

    @Autowired
    private CompanyService companyService;

    @Override
    public void setAsText(String text) {
        Company c = this.companyService.getCompany(Integer.valueOf(text));
        this.setValue(c);
    }
}