com.editor.SkillTypeEditor.java Source code

Java tutorial

Introduction

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

/**
 *
 * @author Dries
 */
@Component
public class SkillTypeEditor extends PropertyEditorSupport {
    @Autowired
    private SkillTypeService skillTypeService;

    @Override
    public void setAsText(String text) {
        SkillType skilltype = this.skillTypeService.getSkillType(Integer.valueOf(text));
        this.setValue(skilltype);
    }
}