Package cn.javass.themes.ssh3.visitors

Source Code of cn.javass.themes.ssh3.visitors.VoPropertyGetterSetter



// Source File Name:   VoPropertyGetterSetter.java

package cn.javass.themes.ssh3.visitors;

import cn.javass.xgen.genconf.vo.ExtendConfModel;
import cn.javass.xgen.genconf.vo.ModuleConfModel;
import cn.javass.xgen.template.visitors.TemplateElement;
import cn.javass.xgen.template.visitors.Visitor;
import java.util.Map;

public class VoPropertyGetterSetter
    implements Visitor
{

    public VoPropertyGetterSetter()
    {
    }

    public Object visitTemplateElement(TemplateElement element)
    {
        ModuleConfModel moduleConf = element.getModuleConf();
        String voFields[] = ((ExtendConfModel)moduleConf.getMapExtends().get("voFields")).getValues();
        String voFieldsTypes[] = ((ExtendConfModel)moduleConf.getMapExtends().get("voFieldsTypes")).getValues();
        StringBuffer buffer = new StringBuffer("");
        for(int i = 0; i < voFields.length; i++)
        {
            buffer.append((new StringBuilder("public void set")).append(voFields[i].substring(0, 1).toUpperCase()).append(voFields[i].substring(1)).append("(").append(voFieldsTypes[i]).append(" obj){\n\t\t").toString());
            buffer.append((new StringBuilder("this.")).append(voFields[i]).append(" = obj;\n\t").toString());
            buffer.append("}\n\t");
            buffer.append((new StringBuilder("public ")).append(voFieldsTypes[i]).append(" get").append(voFields[i].substring(0, 1).toUpperCase()).append(voFields[i].substring(1)).append("(){\n\t\t").toString());
            buffer.append((new StringBuilder("return this.")).append(voFields[i]).append(";\n\t").toString());
            buffer.append("}\n\t");
            buffer.append("\n\t");
        }

        return buffer.toString();
    }
}
TOP

Related Classes of cn.javass.themes.ssh3.visitors.VoPropertyGetterSetter

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.