/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.essar.automation.dhaval.exceltojava;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

/**
 *
 * @author dhaval
 */
public class Field implements CodeGenerator {

    private String name;
    private String originalName;
    private FieldModifier modifier;
    private String type;
    private List<Annotation> annotations;

    public Field() {
        annotations = new ArrayList<Annotation>();
    }

    public FieldModifier getModifier() {
        return modifier;
    }

    public void setModifier(FieldModifier modifier) {
        this.modifier = modifier;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String generateCode() {
        String code = "";
        if(!annotations.isEmpty()){
            code += "\n";
            for(Annotation annotation : annotations){
                code += "\n\t"+ annotation.generateCode();
            }
        }
        code += "\n\tprivate " + type + " " + name + ";";
        return code;
    }

    public void setType(String type) {
        this.type = type;
    }

    public String getType() {
        return type;
    }

    public List<Annotation> getAnnotations() {
        return Collections.unmodifiableList(annotations);
    }

    public void addAnnotation(Annotation annotation){
        annotations.add(annotation);
    }

    public void setOriginalName(String originalName) {
        this.originalName = originalName;
    }

    public String getOriginalName() {
        return originalName;
    }

    
}
