All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.hframework.generator.vm.configureBeanByTemplate.vm Maven / Gradle / Ivy

There is a newer version: 1.0.2
Show newest version
##第一部分:传入参数
#set($map=$MAP)
#set($classDef = $map.get("CLASS"))
##模板内容
package $classDef.classPackage;

#foreach($importClass in $classDef.importClassList)
import $importClass;
#end

$!classDef.annotation
public $classDef.type $classDef.className $!classDef.superClassStr $!classDef.implementsStr {

#foreach($field in $classDef.fieldList)
	$!field.fieldAnno
	private $field.type $field.name;
#end
#foreach($constructor in $classDef.constructorList)

    public ${classDef.className}($!constructor.parameterStr) {
    #foreach($codeLine in $constructor.codelnList)
    	 $!codeLine
    #end
	}
 #end
  $!classDef.extMethodStr
 #foreach($field in $classDef.fieldList)

 	$!fieldgetMethodAnno
	public $field.type get${field.ucName}(){
		return $field.name;
	}

	public void set${field.ucName}(${field.type} ${field.name}){
    	this.$field.name = $field.name;
    }
#end

	private static ${classDef.className} instance;

	private ${classDef.className}() {
		super();
	}

	public  static $classDef.className getInstance(){
		if(instance == null) {
			synchronized (${classDef.className}.class) {
				if(instance == null) {
					try {
						return instance = ResourceWrapper.getResourceBean(${classDef.className}.class);
					} catch (IllegalAccessException e) {
						e.printStackTrace();
					} catch (InstantiationException e) {
						e.printStackTrace();
					} catch (InvocationTargetException e) {
						e.printStackTrace();
					} catch (NoSuchMethodException e) {
						e.printStackTrace();
					}
					return instance = new ${classDef.className}();
				}
			}
		}
		return instance;
	}

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy