com.editor.SkillEditor.java Source code

Java tutorial

Introduction

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

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

    @Autowired
    private SkillService skillService;

    @Override
    public void setAsText(String text) {
        Skill s = this.skillService.getSkill(Integer.valueOf(text));
        this.setValue(s);
    }
}