普元EOS-自定义SDO代码生成模板

news2024/9/20 9:45:49

1 前言

普元EOS的数据实体生成SDO接口和实现类的代码,可以通过自定义代码生成模板,实现代码自定义。

2 模板存放位置

模板存放位置如下:安装目录/dropins/eostools/com.primeton.studio.entity.ui-x.x.x.x.jar里面,SDO模版都在/templates/sdo下。

找到这个jar文件,用winrar打开,注意:不要解压缩到文件夹,只要打开即可。

打开后,找到模板文件夹。

然后将这个文件夹拖拽到本地硬盘上,编辑其中的模板文件,然后再拖拽回去。

最后关闭winrar。这样就完成了jar文件中的模板文件的编辑。

3 删除实现类中大量的注释

在SDO实现类中有大量的注释,看起来很乱,可以修改模板文件 SdoCode.vm 文件,来删除无用的注释。

3.1 编辑覆盖SdoCode.vm 

编辑SdoCode.vm文件,编辑完毕后,拖拽进 winrar 窗口,覆盖jar中对应的文件。

编辑后的SdoCode 内容如下:

#parse("templates/JavaHeader.vm" )
package $javaInfo.getPackageName();

#set($tempImport="")
#foreach($importType in $javaInfo.getImportTypes())
#if( $importType && !$tempImport.contains($importType))
import $importType;
#set($tempImport="$tempImport,$importType")
#else

#end
#end

/**
 * A representation of the model object '<em><b>$javaInfo.getJavaName()</b></em>'.
 */

public class $javaInfo.getJavaName() #if(${javaInfo.getExtendClassInterfaceName()})extends ${javaInfo.getExtendClassInterfaceName()} #end#if(${javaInfo.getImplementInterfaceName()})implements ${javaInfo.getImplementInterfaceName()} #end{
	/**
	 * Comment for <code>serialVersionUID</code>
	 */
	private static final long serialVersionUID = 1L;

#foreach($fieldInfo in $javaInfo.getFieldInfos())
#set ( $index = $velocityCount - 1 )
	public final static int INDEX_$fieldInfo.getFieldName().toUpperCase() = $index;
#end
	public static final int SDO_PROPERTY_COUNT = $javaInfo.getFieldInfos().size();

	public static final int EXTENDED_PROPERTY_COUNT = -1;
##

#parse( "templates/sdo/SdoConstructor.vm" )


	protected void validate() {
		validateType(TYPE);
	}

#parse( "templates/JavaGetSetMethod.vm" )

}

注意:拖拽覆盖前,一定要将EOS IDE关闭,否则该jar文件比占用,是无法被覆盖修改的。

3.2 编辑覆盖 JavaGetSetMethod.vm 

编辑后的文件内容如下:

## get, set ·½·¨
#foreach($fieldInfo in $javaInfo.getFieldInfos())

	public $fieldInfo.getShortTypeName() get${fieldInfo.getCapFieldName()}() {
		return $fieldInfo.getGetMethodString();
	}


	public void set${fieldInfo.getCapFieldName()}($fieldInfo.getShortTypeName() $fieldInfo.getFieldName()) {
		$fieldInfo.getSetMethodString();
	}

#end

3.3 最终效果

原SDO实现类文件如下:

/*******************************************************************************
 *
 * Copyright (c) 2001-2006 Primeton Technologies, Ltd.
 * All rights reserved.
 *
 * Created on Apr 11, 2008
 *******************************************************************************/
package com.primeton.eos.KgptDemo.model.kgptdemo.ProjectDataset.impl;

import com.primeton.eos.KgptDemo.model.kgptdemo.ProjectDataset.TProject;
import com.primeton.ext.data.sdo.DataUtil;
import com.primeton.ext.data.sdo.ExtendedDataObjectImpl;
import commonj.sdo.Type;
import java.util.Date;

/**
 * <!-- begin-user-doc2 -->
 * A representation of the model object '<em><b>TProjectImpl</b></em>'.
 * <!-- end-user-doc2 -->
 *
 * <p>
 * The following features are supported:
 * <ul>
 *   <li>{@link com.primeton.eos.KgptDemo.model.kgptdemo.ProjectDataset.impl.TProjectImpl#getId <em>Id</em> <desc></desc>}</li>
 *   <li>{@link com.primeton.eos.KgptDemo.model.kgptdemo.ProjectDataset.impl.TProjectImpl#getProjectCode <em>ProjectCode</em> <desc>项目Code</desc>}</li>
 *   <li>{@link com.primeton.eos.KgptDemo.model.kgptdemo.ProjectDataset.impl.TProjectImpl#getProjectName <em>ProjectName</em> <desc>项目名称</desc>}</li>
 *   <li>{@link com.primeton.eos.KgptDemo.model.kgptdemo.ProjectDataset.impl.TProjectImpl#getProjectType <em>ProjectType</em> <desc>项目类型</desc>}</li>
 *   <li>{@link com.primeton.eos.KgptDemo.model.kgptdemo.ProjectDataset.impl.TProjectImpl#getProjectTemplateId <em>ProjectTemplateId</em> <desc>项目模板Id</desc>}</li>
 *   <li>{@link com.primeton.eos.KgptDemo.model.kgptdemo.ProjectDataset.impl.TProjectImpl#getCreateTime <em>CreateTime</em> <desc>新增时间</desc>}</li>
 *   <li>{@link com.primeton.eos.KgptDemo.model.kgptdemo.ProjectDataset.impl.TProjectImpl#getCreateUser <em>CreateUser</em> <desc>新增用户</desc>}</li>
 *   <li>{@link com.primeton.eos.KgptDemo.model.kgptdemo.ProjectDataset.impl.TProjectImpl#getUpdateTime <em>UpdateTime</em> <desc>最后更新时间</desc>}</li>
 *   <li>{@link com.primeton.eos.KgptDemo.model.kgptdemo.ProjectDataset.impl.TProjectImpl#getUpdateUser <em>UpdateUser</em> <desc>最后更新人</desc>}</li>
 *   <li>{@link com.primeton.eos.KgptDemo.model.kgptdemo.ProjectDataset.impl.TProjectImpl#getSortNo <em>SortNo</em> <desc>排序号</desc>}</li>
 *   <li>{@link com.primeton.eos.KgptDemo.model.kgptdemo.ProjectDataset.impl.TProjectImpl#getVersion <em>Version</em> <desc>乐观锁</desc>}</li>
 *   <li>{@link com.primeton.eos.KgptDemo.model.kgptdemo.ProjectDataset.impl.TProjectImpl#getTenantId <em>TenantId</em> <desc>租户id</desc>}</li>
 * </ul>
 * </p>
 *
 * @extends ExtendedDataObjectImpl;
 *
 * @implements TProject;
 */

public class TProjectImpl extends ExtendedDataObjectImpl implements TProject {
	/**
	 * Comment for <code>serialVersionUID</code>
	 */
	private static final long serialVersionUID = 1L;

	public final static int INDEX_ID = 0;
	public final static int INDEX_PROJECTCODE = 1;
	public final static int INDEX_PROJECTNAME = 2;
	public final static int INDEX_PROJECTTYPE = 3;
	public final static int INDEX_PROJECTTEMPLATEID = 4;
	public final static int INDEX_CREATETIME = 5;
	public final static int INDEX_CREATEUSER = 6;
	public final static int INDEX_UPDATETIME = 7;
	public final static int INDEX_UPDATEUSER = 8;
	public final static int INDEX_SORTNO = 9;
	public final static int INDEX_VERSION = 10;
	public final static int INDEX_TENANTID = 11;
	public static final int SDO_PROPERTY_COUNT = 12;

	public static final int EXTENDED_PROPERTY_COUNT = -1;

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 */
	public TProjectImpl() {
		this(TYPE);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 */
	public TProjectImpl(Type type) {
		super(type);
	}

	protected void validate() {
		validateType(TYPE);
	}

	/**
	 * Returns the value of the '<em><b>Id</b></em>' attribute.
	 * <!-- begin-user-doc -->
	 * <p>
	 * If the meaning of the '<em>Id</em>' attribute isn't clear,
	 * there really should be more of a description here...
	 * </p>
	 * <!-- end-user-doc -->
	 * @return the value of the '<em>Id</em>' attribute.
	 * @see #setId(java.lang.String)
	 */
	public String getId() {
		return DataUtil.toString(super.getByIndex(INDEX_ID, true));
	}

	/**
	 * Sets the value of the '{@link com.primeton.eos.Test#getId <em>Id</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @param value the new value of the '<em>Id</em>' attribute.
	 * @see #getId()
	 */
	public void setId(String id) {
		super.setByIndex(INDEX_ID, id);
	}

	/**
	 * Returns the value of the '<em><b>ProjectCode</b></em>' attribute.
	 * <!-- begin-user-doc -->
	 * <p>
	 * If the meaning of the '<em>ProjectCode</em>' attribute isn't clear,
	 * there really should be more of a description here...
	 * </p>
	 * <!-- end-user-doc -->
	 * @return the value of the '<em>ProjectCode</em>' attribute.
	 * @see #setProjectCode(java.lang.String)
	 */
	public String getProjectCode() {
		return DataUtil.toString(super.getByIndex(INDEX_PROJECTCODE, true));
	}

	/**
	 * Sets the value of the '{@link com.primeton.eos.Test#getProjectCode <em>ProjectCode</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @param value the new value of the '<em>ProjectCode</em>' attribute.
	 * @see #getProjectCode()
	 */
	public void setProjectCode(String projectCode) {
		super.setByIndex(INDEX_PROJECTCODE, projectCode);
	}

	/**
	 * Returns the value of the '<em><b>ProjectName</b></em>' attribute.
	 * <!-- begin-user-doc -->
	 * <p>
	 * If the meaning of the '<em>ProjectName</em>' attribute isn't clear,
	 * there really should be more of a description here...
	 * </p>
	 * <!-- end-user-doc -->
	 * @return the value of the '<em>ProjectName</em>' attribute.
	 * @see #setProjectName(java.lang.String)
	 */
	public String getProjectName() {
		return DataUtil.toString(super.getByIndex(INDEX_PROJECTNAME, true));
	}

	/**
	 * Sets the value of the '{@link com.primeton.eos.Test#getProjectName <em>ProjectName</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @param value the new value of the '<em>ProjectName</em>' attribute.
	 * @see #getProjectName()
	 */
	public void setProjectName(String projectName) {
		super.setByIndex(INDEX_PROJECTNAME, projectName);
	}

	/**
	 * Returns the value of the '<em><b>ProjectType</b></em>' attribute.
	 * <!-- begin-user-doc -->
	 * <p>
	 * If the meaning of the '<em>ProjectType</em>' attribute isn't clear,
	 * there really should be more of a description here...
	 * </p>
	 * <!-- end-user-doc -->
	 * @return the value of the '<em>ProjectType</em>' attribute.
	 * @see #setProjectType(java.lang.String)
	 */
	public String getProjectType() {
		return DataUtil.toString(super.getByIndex(INDEX_PROJECTTYPE, true));
	}

	/**
	 * Sets the value of the '{@link com.primeton.eos.Test#getProjectType <em>ProjectType</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @param value the new value of the '<em>ProjectType</em>' attribute.
	 * @see #getProjectType()
	 */
	public void setProjectType(String projectType) {
		super.setByIndex(INDEX_PROJECTTYPE, projectType);
	}

	/**
	 * Returns the value of the '<em><b>ProjectTemplateId</b></em>' attribute.
	 * <!-- begin-user-doc -->
	 * <p>
	 * If the meaning of the '<em>ProjectTemplateId</em>' attribute isn't clear,
	 * there really should be more of a description here...
	 * </p>
	 * <!-- end-user-doc -->
	 * @return the value of the '<em>ProjectTemplateId</em>' attribute.
	 * @see #setProjectTemplateId(java.lang.String)
	 */
	public String getProjectTemplateId() {
		return DataUtil.toString(super.getByIndex(INDEX_PROJECTTEMPLATEID, true));
	}

	/**
	 * Sets the value of the '{@link com.primeton.eos.Test#getProjectTemplateId <em>ProjectTemplateId</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @param value the new value of the '<em>ProjectTemplateId</em>' attribute.
	 * @see #getProjectTemplateId()
	 */
	public void setProjectTemplateId(String projectTemplateId) {
		super.setByIndex(INDEX_PROJECTTEMPLATEID, projectTemplateId);
	}

	/**
	 * Returns the value of the '<em><b>CreateTime</b></em>' attribute.
	 * <!-- begin-user-doc -->
	 * <p>
	 * If the meaning of the '<em>CreateTime</em>' attribute isn't clear,
	 * there really should be more of a description here...
	 * </p>
	 * <!-- end-user-doc -->
	 * @return the value of the '<em>CreateTime</em>' attribute.
	 * @see #setCreateTime(java.util.Date)
	 */
	public Date getCreateTime() {
		return DataUtil.toDate(super.getByIndex(INDEX_CREATETIME, true));
	}

	/**
	 * Sets the value of the '{@link com.primeton.eos.Test#getCreateTime <em>CreateTime</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @param value the new value of the '<em>CreateTime</em>' attribute.
	 * @see #getCreateTime()
	 */
	public void setCreateTime(Date createTime) {
		super.setByIndex(INDEX_CREATETIME, createTime);
	}

	/**
	 * Returns the value of the '<em><b>CreateUser</b></em>' attribute.
	 * <!-- begin-user-doc -->
	 * <p>
	 * If the meaning of the '<em>CreateUser</em>' attribute isn't clear,
	 * there really should be more of a description here...
	 * </p>
	 * <!-- end-user-doc -->
	 * @return the value of the '<em>CreateUser</em>' attribute.
	 * @see #setCreateUser(java.lang.String)
	 */
	public String getCreateUser() {
		return DataUtil.toString(super.getByIndex(INDEX_CREATEUSER, true));
	}

	/**
	 * Sets the value of the '{@link com.primeton.eos.Test#getCreateUser <em>CreateUser</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @param value the new value of the '<em>CreateUser</em>' attribute.
	 * @see #getCreateUser()
	 */
	public void setCreateUser(String createUser) {
		super.setByIndex(INDEX_CREATEUSER, createUser);
	}

	/**
	 * Returns the value of the '<em><b>UpdateTime</b></em>' attribute.
	 * <!-- begin-user-doc -->
	 * <p>
	 * If the meaning of the '<em>UpdateTime</em>' attribute isn't clear,
	 * there really should be more of a description here...
	 * </p>
	 * <!-- end-user-doc -->
	 * @return the value of the '<em>UpdateTime</em>' attribute.
	 * @see #setUpdateTime(java.util.Date)
	 */
	public Date getUpdateTime() {
		return DataUtil.toDate(super.getByIndex(INDEX_UPDATETIME, true));
	}

	/**
	 * Sets the value of the '{@link com.primeton.eos.Test#getUpdateTime <em>UpdateTime</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @param value the new value of the '<em>UpdateTime</em>' attribute.
	 * @see #getUpdateTime()
	 */
	public void setUpdateTime(Date updateTime) {
		super.setByIndex(INDEX_UPDATETIME, updateTime);
	}

	/**
	 * Returns the value of the '<em><b>UpdateUser</b></em>' attribute.
	 * <!-- begin-user-doc -->
	 * <p>
	 * If the meaning of the '<em>UpdateUser</em>' attribute isn't clear,
	 * there really should be more of a description here...
	 * </p>
	 * <!-- end-user-doc -->
	 * @return the value of the '<em>UpdateUser</em>' attribute.
	 * @see #setUpdateUser(java.lang.String)
	 */
	public String getUpdateUser() {
		return DataUtil.toString(super.getByIndex(INDEX_UPDATEUSER, true));
	}

	/**
	 * Sets the value of the '{@link com.primeton.eos.Test#getUpdateUser <em>UpdateUser</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @param value the new value of the '<em>UpdateUser</em>' attribute.
	 * @see #getUpdateUser()
	 */
	public void setUpdateUser(String updateUser) {
		super.setByIndex(INDEX_UPDATEUSER, updateUser);
	}

	/**
	 * Returns the value of the '<em><b>SortNo</b></em>' attribute.
	 * <!-- begin-user-doc -->
	 * <p>
	 * If the meaning of the '<em>SortNo</em>' attribute isn't clear,
	 * there really should be more of a description here...
	 * </p>
	 * <!-- end-user-doc -->
	 * @return the value of the '<em>SortNo</em>' attribute.
	 * @see #setSortNo(int)
	 */
	public int getSortNo() {
		return DataUtil.toInt(super.getByIndex(INDEX_SORTNO, true));
	}

	/**
	 * Sets the value of the '{@link com.primeton.eos.Test#getSortNo <em>SortNo</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @param value the new value of the '<em>SortNo</em>' attribute.
	 * @see #getSortNo()
	 */
	public void setSortNo(int sortNo) {
		super.setByIndex(INDEX_SORTNO, sortNo);
	}

	/**
	 * Returns the value of the '<em><b>Version</b></em>' attribute.
	 * <!-- begin-user-doc -->
	 * <p>
	 * If the meaning of the '<em>Version</em>' attribute isn't clear,
	 * there really should be more of a description here...
	 * </p>
	 * <!-- end-user-doc -->
	 * @return the value of the '<em>Version</em>' attribute.
	 * @see #setVersion(int)
	 */
	public int getVersion() {
		return DataUtil.toInt(super.getByIndex(INDEX_VERSION, true));
	}

	/**
	 * Sets the value of the '{@link com.primeton.eos.Test#getVersion <em>Version</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @param value the new value of the '<em>Version</em>' attribute.
	 * @see #getVersion()
	 */
	public void setVersion(int version) {
		super.setByIndex(INDEX_VERSION, version);
	}

	/**
	 * Returns the value of the '<em><b>TenantId</b></em>' attribute.
	 * <!-- begin-user-doc -->
	 * <p>
	 * If the meaning of the '<em>TenantId</em>' attribute isn't clear,
	 * there really should be more of a description here...
	 * </p>
	 * <!-- end-user-doc -->
	 * @return the value of the '<em>TenantId</em>' attribute.
	 * @see #setTenantId(java.lang.String)
	 */
	public String getTenantId() {
		return DataUtil.toString(super.getByIndex(INDEX_TENANTID, true));
	}

	/**
	 * Sets the value of the '{@link com.primeton.eos.Test#getTenantId <em>TenantId</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @param value the new value of the '<em>TenantId</em>' attribute.
	 * @see #getTenantId()
	 */
	public void setTenantId(String tenantId) {
		super.setByIndex(INDEX_TENANTID, tenantId);
	}


}

修改后,实现类文件如下:

/*******************************************************************************
 *
 * Copyright (c) 2001-2006 Primeton Technologies, Ltd.
 * All rights reserved.
 *
 * Created on Apr 11, 2008
 *******************************************************************************/
package com.primeton.eos.KgptDemo.model.kgptdemo.ProjectDataset.impl;

import com.primeton.eos.KgptDemo.model.kgptdemo.ProjectDataset.TProject;
import com.primeton.ext.data.sdo.DataUtil;
import com.primeton.ext.data.sdo.ExtendedDataObjectImpl;
import commonj.sdo.Type;
import java.util.Date;

/**
 * A representation of the model object '<em><b>TProjectImpl</b></em>'.
 */

public class TProjectImpl extends ExtendedDataObjectImpl implements TProject {
	/**
	 * Comment for <code>serialVersionUID</code>
	 */
	private static final long serialVersionUID = 1L;

	public final static int INDEX_ID = 0;
	public final static int INDEX_PROJECTCODE = 1;
	public final static int INDEX_PROJECTNAME = 2;
	public final static int INDEX_PROJECTTYPE = 3;
	public final static int INDEX_PROJECTTEMPLATEID = 4;
	public final static int INDEX_CREATETIME = 5;
	public final static int INDEX_CREATEUSER = 6;
	public final static int INDEX_UPDATETIME = 7;
	public final static int INDEX_UPDATEUSER = 8;
	public final static int INDEX_SORTNO = 9;
	public final static int INDEX_VERSION = 10;
	public final static int INDEX_TENANTID = 11;
	public static final int SDO_PROPERTY_COUNT = 12;

	public static final int EXTENDED_PROPERTY_COUNT = -1;

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 */
	public TProjectImpl() {
		this(TYPE);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 */
	public TProjectImpl(Type type) {
		super(type);
	}

	protected void validate() {
		validateType(TYPE);
	}


	public String getId() {
		return DataUtil.toString(super.getByIndex(INDEX_ID, true));
	}


	public void setId(String id) {
		super.setByIndex(INDEX_ID, id);
	}


	public String getProjectCode() {
		return DataUtil.toString(super.getByIndex(INDEX_PROJECTCODE, true));
	}


	public void setProjectCode(String projectCode) {
		super.setByIndex(INDEX_PROJECTCODE, projectCode);
	}


	public String getProjectName() {
		return DataUtil.toString(super.getByIndex(INDEX_PROJECTNAME, true));
	}


	public void setProjectName(String projectName) {
		super.setByIndex(INDEX_PROJECTNAME, projectName);
	}


	public String getProjectType() {
		return DataUtil.toString(super.getByIndex(INDEX_PROJECTTYPE, true));
	}


	public void setProjectType(String projectType) {
		super.setByIndex(INDEX_PROJECTTYPE, projectType);
	}


	public String getProjectTemplateId() {
		return DataUtil.toString(super.getByIndex(INDEX_PROJECTTEMPLATEID, true));
	}


	public void setProjectTemplateId(String projectTemplateId) {
		super.setByIndex(INDEX_PROJECTTEMPLATEID, projectTemplateId);
	}


	public Date getCreateTime() {
		return DataUtil.toDate(super.getByIndex(INDEX_CREATETIME, true));
	}


	public void setCreateTime(Date createTime) {
		super.setByIndex(INDEX_CREATETIME, createTime);
	}


	public String getCreateUser() {
		return DataUtil.toString(super.getByIndex(INDEX_CREATEUSER, true));
	}


	public void setCreateUser(String createUser) {
		super.setByIndex(INDEX_CREATEUSER, createUser);
	}


	public Date getUpdateTime() {
		return DataUtil.toDate(super.getByIndex(INDEX_UPDATETIME, true));
	}


	public void setUpdateTime(Date updateTime) {
		super.setByIndex(INDEX_UPDATETIME, updateTime);
	}


	public String getUpdateUser() {
		return DataUtil.toString(super.getByIndex(INDEX_UPDATEUSER, true));
	}


	public void setUpdateUser(String updateUser) {
		super.setByIndex(INDEX_UPDATEUSER, updateUser);
	}


	public int getSortNo() {
		return DataUtil.toInt(super.getByIndex(INDEX_SORTNO, true));
	}


	public void setSortNo(int sortNo) {
		super.setByIndex(INDEX_SORTNO, sortNo);
	}


	public int getVersion() {
		return DataUtil.toInt(super.getByIndex(INDEX_VERSION, true));
	}


	public void setVersion(int version) {
		super.setByIndex(INDEX_VERSION, version);
	}


	public String getTenantId() {
		return DataUtil.toString(super.getByIndex(INDEX_TENANTID, true));
	}


	public void setTenantId(String tenantId) {
		super.setByIndex(INDEX_TENANTID, tenantId);
	}


}

可以看到,新代码简洁多了。

4 在SDO接口中增加字段名常量

修改 SdoInterfaceCode.vm 文件,在文件中增加如下代码:

## FieldName Const
#foreach($fieldInfo in $javaInfo.getFieldInfos())
    public static final String FIELD_NAME_$fieldInfo.getFieldName().toUpperCase() = "$fieldInfo.getFieldName()";
#end

完整代码效果如下:

#parse("templates/JavaHeader.vm" )
package $javaInfo.getPackageName();

#set($tempImport="")
#foreach($importType in $javaInfo.getImportTypes())
#if( $importType && !$tempImport.contains($importType))
import $importType;
#set($tempImport="$tempImport,$importType")
#else


#end
#end

/**
#if($javaInfo.getExtendClassInterfaceName())
#foreach($extendInterface in $javaInfo.getExtendClassInterfaceName().split("[,]"))
#if( $extendInterface )
 * @extends $extendInterface;
#end
#end
 */
public interface $javaInfo.getJavaName() extends ${javaInfo.getExtendClassInterfaceName()} {
#else
 */
public interface $javaInfo.getJavaName() {
#end

	public String QNAME = "${javaInfo.getPackageName()}.${javaInfo.getJavaName()}";

	public Type TYPE = TypeHelper.INSTANCE.getType("$javaInfo.getPackageName()", "$javaInfo.getJavaName()");

	public static final IObjectFactory<$javaInfo.getJavaName()> FACTORY = new IObjectFactory<$javaInfo.getJavaName()>() {
		public $javaInfo.getJavaName() create() {
            Type type = TYPE;
			if(type == null) {
				type = TypeHelper.INSTANCE.getType("$javaInfo.getPackageName()", "$javaInfo.getJavaName()");
			}
			if(type == null) {
				throw new IllegalDataObjectTypeException("cannot find entity type: " + QNAME);	
			}
			return ($javaInfo.getJavaName()) DataFactory.INSTANCE.create(type);
		}
	};

## FieldName Const
#foreach($fieldInfo in $javaInfo.getFieldInfos())
    public static final String FIELD_NAME_$fieldInfo.getFieldName().toUpperCase() = "$fieldInfo.getFieldName()";
#end

## get, set
#foreach($fieldInfo in $javaInfo.getFieldInfos())

	public $fieldInfo.getShortTypeName() get${fieldInfo.getCapFieldName()}();

	public void set${fieldInfo.getCapFieldName()}($fieldInfo.getShortTypeName() $fieldInfo.getFieldName());

#end

}

最终我们看到 SDO接口中增加了字段名常量

    public static final String FIELD_NAME_ID = "id";
    public static final String FIELD_NAME_PROJECTCODE = "projectCode";
    public static final String FIELD_NAME_PROJECTNAME = "projectName";
    public static final String FIELD_NAME_PROJECTTYPE = "projectType";
    public static final String FIELD_NAME_PROJECTTEMPLATEID = "projectTemplateId";
    public static final String FIELD_NAME_CREATETIME = "createTime";
    public static final String FIELD_NAME_CREATEUSER = "createUser";
    public static final String FIELD_NAME_UPDATETIME = "updateTime";
    public static final String FIELD_NAME_UPDATEUSER = "updateUser";
    public static final String FIELD_NAME_SORTNO = "sortNo";
    public static final String FIELD_NAME_VERSION = "version";
    public static final String FIELD_NAME_TENANTID = "tenantId";

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/2069563.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

揭秘CAAC、AOPA、ALPA、ASFC和UTC无人机执照的差别及实用价值

CAAC、AOPA、ALPA、ASFC和UTC无人机执照各有其独特的差别及实用价值&#xff0c;以下是针对这些执照的详细解析&#xff1a; 一、CAAC无人机执照 颁发机构&#xff1a;中国民用航空局&#xff08;CAAC&#xff09; 差别&#xff1a; - 权威性&#xff1a;CAAC无人机执照是目…

Go机器学习框架之火重燃,Google前研究员开源期望媲美Jax的GoMLX

Go作为一门兼具高性能与简洁性的编程语言&#xff0c;近年来在各种领域得到广泛应用。然而&#xff0c;在机器学习领域&#xff0c;Go相比Python、C、Julia等语言&#xff0c;生态仍然较为薄弱。目前的Go机器学习框架无论在功能全面性上&#xff0c;还是在社区生态支持上都难以…

2024升级zblog小程序开源源码/基于uniapp开发的(支持微信小程序、百度小程序、安卓APP)

源码简介&#xff1a; 2024最新zblog多端小程序开源源码&#xff0c;它是基于uniapp开发的&#xff0c;它是针对和支持微信小程序、百度小程序和安卓APP哦&#xff01;百度百科小程序源码下载。 这个基于uniapp开发的zblog多端小程序开源源码&#xff0c;听说对收录和SEO都有…

Android 添加系统服务的实现

和你一起终身学习&#xff0c;这里是程序员Android 本篇文章主要介绍 Android 开发中的部分知识点&#xff0c;通过阅读本篇文章&#xff0c;您将收获以下内容: 一、前言二、编写AIDL文件三、编写Manager类四、 编写系统服务五、 注册系统服务六、注册Manager七、App调用八、添…

设计模式 -- 七大原则(五)-- 开闭原则

1 基本介绍 开闭原则&#xff08;Open Closed Principle&#xff0c;简称OCP&#xff09;是编程中最基础、最重要的设计原则 一个软件实体如类&#xff0c;模块和函数应该对扩展开放(对提供方)&#xff0c;对修改关闭(对使用方)。用抽象构建框架&#xff0c;用实现扩展细节。 …

伯努利朴素贝叶斯解析:面向初学者的带代码示例的视觉指南

通过二进制简单性释放预测能力&#xff0c;欢迎来到雲闪世界。 添加图片注释&#xff0c;不超过 140 字&#xff08;可选&#xff09; 与虚拟分类器的基线方法或基于相似性的 KNN 推理不同&#xff0c;朴素贝叶斯利用了概率论。它结合了每个“线索”&#xff08;或特征&#xf…

宿舍管理系统设计与分析

第一章 管理信息系统概述 在人类进入21世纪之际&#xff0c;随着社会的组织化程度以及企业生产的社会化程度越来越高&#xff0c;信息作为一种资源已经和材料、能源并称为现代社会化发展的三大支柱之一。管理信息系统是融科学、信息科学、系统工程以及现代通讯技术、计算机技术…

阿里HPN-大型语言模型训练的数据中心网络架构

阿里巴巴HPN:用于大型语言模型训练的数据中心网络 摘要 本文介绍了阿里云用于大型语言模型(LLM)训练的数据中心网络HPN。由于LLM和一般云计算之间的差异(例如&#xff0c;在流量模式和容错性方面)&#xff0c;传统的数据中心网络不太适合LLM训练。这就要求我们专门为LLM培训设…

【NetTopologySuite类库】多边形的五种包围盒(AABB、OBB、包围圆、八边形、凸包)

示例 用的是NetTopologySuite1.5.3版本。 var r new WKTReader(); var wkt "polygon((0 0,0 0.5,1 2,5 0,4 -2,3 -1, 0 0))"; var rawGeo r.Read(wkt); var b1 rawGeo.Envelope;//AABB var b2 new MinimumBoundingCircle(rawGeo).GetCircle();//包围圆 var b3…

基于GeoToolKit实现三维断面的绘制研究

GeoToolkit默认自带PillarSurfaceData的三维断面绘制要求断棱(有时叫断柱)必须是单调的,否则组件底层就会自动优化,导致断面出现回弯,相当于出现重叠,无法实现最终的效果。因此,本文主要在之前文章的基础上,拓展了GeoToolKit的三维断面显示功能。本文主要基于GeoToolKi…

计算机毕业设计hadoop+spark+hive漫画推荐系统 动漫视频推荐系统 漫画分析可视化大屏 漫画爬虫 漫画推荐系统 漫画爬虫 知识图谱 大数据

流程&#xff1a;1.DrissionPageSelenium自动爬虫工具采集漫画视频、详情、标签等约200万条漫画数据存入mysql数据库&#xff1b; 2.Mapreduce对采集的动漫数据进行数据清洗、拆分数据项等&#xff0c;转为.csv文件上传hadoop的hdfs集群&#xff1b; 3.hive建库建表导入.csv动漫…

能精准捕捉股价波峰波谷的 Findpeaks

作者:老余捞鱼 原创不易,转载请标明出处及原作者。 写在前面的话: 在AI对金融产品进行价值分析中,检测波峰波谷具有至关重要的应用意义。投资者可以直接观察股票价格走势图,通过肉眼识别波峰和波谷的位置。这种方法简单易行,但主观性较强,可能受到投资者个人经验…

【最长公共上升子序列】

题目 解决 for (int i 1; i < n; i)for (int j 1; j < n; j){ f[i][j] f[i - 1][j];if (a[i] b[j]){ f[i][j] max(f[i][j], 1);for (int k 1; k < j; k)if (b[j] > b[k])f[i][j] max(f[i][j], f[i - 1][k] 1);} } 先假设不影响结果&#xff0c;纳入 &…

大语言模型的“智能飞轮”!阿里最新综述全面解析大模型的自进化之路

©PaperWeekly 原创 作者 | 林廷恩 单位 | 阿里通义实验室算法研究员 研究方向 | 自然语言处理 想象一下&#xff0c;一个 AI 不仅能学习&#xff0c;还能自我改进&#xff0c;变得越来越聪明。这不是科幻小说&#xff0c;而是我们正在见证的现实。大语言模型&#xff08;…

pdf有密码,如何实现pdf转换word?

PDF想要转换成其他格式&#xff0c;但是当我们将文件拖到PDF转换器进行转换的时候发现PDF文件带有密码怎么办&#xff1f;今天分享PDF有密码如何转换成word方法。 方法一、 PDF文件有两种密码&#xff0c;打开密码和限制编辑&#xff0c;如果是因为打开密码&#xff0c;建议使…

全套安全帽佩戴检测算法源码与实战应用分享

在许多工业环境中&#xff0c;安全帽是确保工人安全的重要防护装备。为了降低工人受伤的风险&#xff0c;尤其是在建筑工地、矿山、工厂等高危环境下&#xff0c;确保工人正确佩戴安全帽是至关重要的。然而&#xff0c;由于现场管理的复杂性和人员流动性&#xff0c;单靠人工监…

Chrome H265 WebRTC 支持

Chrome从127版本开始支持RTC H265解码&#xff0c;这样服务器就不需要对H265转码了&#xff0c; H5S和USC会自动检测浏览器支持的解码类型并自动判断是否启动转码&#xff0c;这样客户端不用关心摄像机具体是H264还是H265&#xff0c;尽量使用带GPU的客户端&#xff0c;这样服务…

什么是红黑树-面试中常问的数据结构

你有没有想过,为什么你的 Java HashMap 能够如此高效地处理数百万个键值对?或者你的 Linux 系统是如何在眨眼间就能管理成千上万的进程的?这些看似神奇的性能背后,隐藏着一个优雅而强大的数据结构 - 红黑树。 目录 什么是红黑树?红黑树的特性为什么需要红黑树?红黑树的结…

java基础 之 抽象类

文章目录 前言抽象类浅浅的理解下抽象类关键字&#xff1a;abstract抽象类 VS 普通类特点 前言 1、类是一个模板&#xff0c;类被继承后成为父类&#xff0c;继承父类的类称为子类。 2、子类可以对父类的方法进行重写&#xff0c;也可以直接使用父类的方法。 3、类称为继承&…

鸿蒙笔记--WorkerTaskPool

这一节了解一下鸿蒙中的Worker和TaskPool,Worker和TaskPool的作用是为应用程序提供一个多线程的运行环境&#xff0c;用于处理耗时的计算任务或其他密集型任务。可以有效地避免这些任务阻塞主线程&#xff0c;从而最大化系统的利用率&#xff0c;降低整体资源消耗&#xff0c;并…