- 浏览: 3472065 次
- 性别:
- 来自: 北京
文章分类
最新评论
-
wanglf1207:
EJB的确是个不错的产品,只是因为用起来有点门槛,招来太多人吐 ...
weblogic-ejb-jar.xml的元素解析 -
qwfys200:
总结的不错。
Spring Web Flow 2.0 入门 -
u011577913:
u011577913 写道也能给我发一份翻译文档? 邮件437 ...
Hazelcast 参考文档-4 -
u011577913:
也能给我发一份翻译文档?
Hazelcast 参考文档-4 -
songzj001:
DbUnit入门实战
Code Templates are written as plain text, using Enterprise Architect's code template editor (see The Code Template Editor ). The template syntax centers on three basic constructs:
Templates can contain any or all of these constructs.
Literal Text
All text within a given template that is not part of a macro or a variable definition/reference, is considered literal text. With the exception of blank lines, which are ignored, literal text is directly substituted from the template into the generated code.
Consider the following excerpt from the java Class Declaration template:
%PI=" "%
%CONVERT_SCOPE(classScope)%
%classStereotype=="static" ? "static": ""%
%classStereotype=="final" ? "final": ""%
%classStereotype=="static final" ? "static final": ""%
%classAbstract=="T" ? "abstract": ""%
%PI=""%
class %className%$bases
On the final line, the word class , including the subsequent space, would be treated as literal text and thus reproduced in the output. The blank line following the CONVERT_SCOPE macro, however, would have no effect on the output.
The %, $ and " characters have special meaning in the template syntax and cannot always be used as literal text. If these characters must be generated from within the templates, they can be safely reproduced using the following direct substitution macros:
Macro |
Use to |
%dl% |
Produce a literal $ character. |
%pc% |
Produce a literal % character. |
%qt% |
Produce a literal " character. |
Macros
Macros provide access to element fields within the UML model and are also used to structure the generated output. All macros are enclosed within percent ( % ) signs. The CTF contains six basic types of macros:
- Template substitution macros
- Field substitution macros
- Tagged Value substitution macros
- Control macros
- Function macros
- EASL code generation macros
In general, macros (including the % delimiters) are substituted with literal text in the output. For example consider the following item from the Class Declaration template:
... class %className% ...
The field substitution macro, %className% , would result in the current Class name being substituted in the output. So if the Class being generated was named Foo , the output would be:
... class Foo ...
Variables
Template variables provide a convenient way of storing and retrieving data within a template. This section explains how variables are defined and referenced .
Variable Definitions
Variable definitions take the basic form:
$<name> = <value>
where <name> can be any alpha-numeric sequence and <value> is derived from a macro or another variable.
A simple example definition would be:
$foo = %className%
Variables can be defined, using values from:
- Substitution, function or list macros
- String literals, enclosed within double quotation marks
- Variable references.
Definition Rules
The following rules apply to variable definitions:
- Variables have global scope within the template in which they are defined and are not accessible to other templates
- Each variable must be defined at the start of a line, without any intervening whitespace
- Variables are denoted by prefixing the name with $, as in $foo
- Variables do not have to be declared, prior to being defined
- Variables must be defined using either the assignment operator (=), or the addition-assignment operator (+=)
- Multiple terms can be combined in a single definition using the addition operator (+).
Examples
Using a substitution macro:
$foo = %opTag:"bar"%
Using a literal string:
$foo = "bar"
Using another variable:
$foo = $bar
Using a list macro:
$ops = %list="Operation" @separator="\n\n" @indent="\t"%
Using the addition-assignment operator ( += ):
$body += %list="Operation" @separator="\n\n" @indent="\t"%
The above definition is equivalent to the following:
$body = $body + %list="Operation" @separator="\n\n" @indent="\t"%
Using multiple terms:
$templateArgs = %list="ClassParameter" @separator=", "%
$template ="template<" + $templateArgs + ">"
Variable References
Variable values can be retrieved by using a reference of the form:
$<name>
where <name> can be a previously defined variable.
Variable references can be used in one of the following ways:
- As part of a macro, such as the argument to a function macro
- As a term in a variable definition
- As a direct substitution of the variable value into the output.
Note: |
It is legal to reference a variable before it is defined. In this case, the variable is assumed to contain an empty string value: "" |
Example 1
Using variables as part of a macro. The following is an excerpt from the default C++ ClassNotes template.
$wrapLen = %genOptWrapComment% $style = %genOptCPPCommentStyle%
%if $style == "XML.NET"% %XML_COMMENT($wrapLen)% %else% %CSTYLE_COMMENT($wrapLen)% %endIf% |
Define variables to store the style and wrap length options.
Reference to
$style
as part of a condition.
Reference to $wrapLen as an argument to function macro. |
Example 2
Using variable references as part of a variable definitions:
$foo = "foo" $bar = "bar"
$foobar = $foo + $bar |
Define our variables. $foobar now contains the value foobar. |
Example 3
Substituting variable values into the output
$bases=%classInherits%
Class %className%$bases |
Store the result of the ClassInherits template in $bases. Now output the value of $bases after the Class name. |
发表评论
-
js压缩工具(转载)
2012-06-07 11:58 9466怎么压缩Js?为什么要压缩Javascript? Javasc ... -
maven常见问题问答
2012-05-05 11:34 88641.前言 Maven,发音是[`meivin ... -
Eclipse Indigo - Cannot install Android ADT Plugin
2012-02-29 01:17 3836When I try to install the And ... -
Eclipse Indigo - Cannot install Android ADT Plugin
2012-02-29 01:13 1939When I try to install the And ... -
使用iconv进行内码转换(Big5->GB2312)
2012-02-26 00:56 3384i conv 是一个通过unicode 作为中间码 ... -
Enterprise Architect's Engineering Code Template Framework Code Templates
2011-12-13 22:57 1755The Code Template Framework c ... -
ActiveX控件在签名以后,仍然被IE浏览器默认安全级阻止而无法安装。
2011-11-18 08:56 5391使用代码签名证书签名后的控件在运行时报“Internet ... -
关于IObjectSafety和ActiveX组件的脚本安全
2011-11-17 19:19 3086都说ActiveX 危险,那么 ... -
在此页上的 ActiveX 控件和本页上的其它部份的交互可能不安全。你想允许这种交互
2011-11-17 19:09 14675如果采用VC++开发的ActiveX,那么第一次运行的时候,I ... -
如何编写 INF 文件
2011-11-16 14:31 2128INF文件全称Information File文件,是Wino ... -
如何在web上实现对另一个应用程序的键盘输入,就像vb中的sendkey
2011-11-16 10:49 3495用 set WshShell = CreateOb ... -
MINGW GCC 4.3.0 安装与配置(解决CREATEPROCESS问题)
2011-07-28 23:53 4663首先,下载Mingw TDM 4.3.0版本http:// ... -
使用 cURL 和 libcurl 通过 Internet 进行对话
2010-02-28 14:41 3590cURL 是一个命令行工具,可以对文件传输使用许多协议, ... -
Eclipse Babel Project Downloads
2010-02-06 21:23 2818Babel Language Packs - 0.7.1 ... -
SIP 软电话开发环境的建立
2010-01-29 00:44 3213要在windows或者linux平台下开发基于SIP的软电 ... -
基于 Eclipse 平台的代码生成技术
2009-10-12 10:09 2807http://www.ibm.com/developerwor ... -
SVK:基于 svn 的分布式版本管理系统
2009-07-11 23:48 1756SVK 是一个基于 Subversion(svn)的分布式 ... -
Firefox+IE11个WEB开发工具
2009-07-11 00:12 4328以前一直不太用FireFox,毕竟是在MS的平台下工作。记得 ... -
让结对编程跨越地理位置的限制
2009-02-14 23:45 2131本文介绍如何利用 ECF(Eclipse Communica ... -
http://download.eclipse.org/technology/babel/updat
2009-02-14 22:59 4984大家不要再想有以前那种中文语言包了,eclipse的国际化 ...
相关推荐
Enterprise Architect 破解版 Enterprise Architect 破解版 Enterprise Architect 破解版 Enterprise Architect 破解版
Enterprise Architect 破解补丁 亲测可破解 EA10
EnterpriseArchitect中文经典教程.pdf
Enterprise Architect 详细使用教程,包含组建解释。
enterprise architect 12(含注册码和中文包),enterprise-architect第一个安装包,第二个中文包
该工具为Enterprise Architect13.5破解版,用于企业及的项目需求分析,架构设计,UML类图的设计工具,非常好用欢迎大家下载使用,有问题私聊我!
Enterprise Architect是一个对于软件系统开发有着极好支持的CASE软件(Computer Aided Software Engineering)。EA不同于普通的UML画图工具(如VISIO),它将支撑系统开发的全过程。在需求分析阶段,系统分析与设计...
ea 汉化版,Enterprise Architect是构建和共享基于业务模型的理想平台,可完全集成到整个企业或系统级架构中。 开发支持从复杂的战略模型到简单的思维导图,过程建模,需求管理,BPMN模型等。
Enterprise Architect 汉化补丁包
Sparx Systems 的Enterprise Architect 是一个完整生命周期的UML 工具: · 设计和建造一个广泛的软件系统 · 业务分析,业务流程建模,管理要求 · 系统建模,系统架构建模,组件设计,仿真 · 广义域特定...
enterprise architect 8.0.864 非试用版
Enterprise Architect(EA)13.0永久试用中文版 无限期30天试用 Enterprise Architect 是Sparx Systems 公司的旗舰产品。它覆盖了系统开发的整个周期,除了开发类模型之外,还包括事务进程分析,使用案例需求,动态...
EnterpriseArchitect13中文版,压缩包里包含安装包和密钥,亲测可用
Sparx Systems Enterprise Architect Modeling Tool Enterprise Architect 13.5 含Key (Ultimate Edition)
UML软件开发与建模工具(Enterprise Architect)是Sparx Systems 公司的旗舰产品。它覆盖了系统开发的整个周期,除了开发类模型之外,还包括事务进程分析,使用案例需求,动态模型,组件和布局,系统管理,非功能需求...
Enterprise Architect 8.0版本,内附汉化方法和注册码,教程非常简单。
Enterprise Architect 8.0汉化包 内含企业版注册码
请免费下载EnterpriseArchitect12中文破解版(2)
Enterprise Architect V7.5汉化破解版,是一个很好的UML设计工具,可以做UML建模
目录 一.EA简介 二.创建新项目 三.EA软件配置 四.用例图,类图的使用 五.其他图形的使用 六.数据建模 七.代码工程 .....