リファレンス: JDeveloperコード・テンプレート

このトピックでは事前定義済のコード・テンプレートを示し、それぞれについてショートカットおよびテンプレートで導入されるコードを示します。

Array Iterator

ai

for (int $i$ = 0; $i$ < $array$.length; $i$++)
{
$type$ $var$ = $array$[$i$];
$end$
}

Data Action Event Handler

daev

public void on$end$(DataActionContext ctx)
{
// Code before executing the default action
if (ctx.getEventActionBinding() != null) ctx.getEventActionBinding().doIt();
// Code after executing the default action
}

for loop

for

for ($end$ ; ; )
{

}

Hml / jsp tag

tag

<$tag$>
$end$
</$tag$>

if statement

if

if ($end$)
{

}

if else statement

ife

if ($end$)
{

} else
{

}

integer based loop

fori

for (int $i$ = 0; $i$ < $lim$; $i$++)
{
$end$
}

integer based loop

forn

int $n$ = $lim$;
for (int $i$ = 0; $i$ < $n$; $i$++)
{
$end$
}

instanceof + cast

iofc

if ($var$ instanceof $type$)
{
$type$ $casted$ = ($type$) $var$;
$end$
}

Instantiate a BC4J application module

bc4jclient

String amDef = "test.TestModule";
String config = "TestModuleLocal";
ApplicationModule am =
Configuration.createRootApplicationModule(amDef,config);
ViewObject vo = am.findViewObject("TestView");
$end$// Work with your appmodule and view object here
Configuration.releaseRootApplicationModule(am,true);

Iterate over array

itar

for (int $i$ = 0; $i$ < $array$.length; $i$++)
{
$type$ $var$ = $array$[$i$];
$end$
}

Iterate over a collection

itco

for(Iterator $iter$ = $col$.iterator();$iter$.hasNext();)
{
$type$ $var$ = ($type$) $iter$.next();
$end$
}

Iterate over a list

itli

for (int $i$ = 0; $i$ < $list$.size(); $i$++)
{
$type$ $var$ = ($type$) $list$.get($i$);
$end$
}

Iterate over map keys

itmk

Iterator $iter$ = $map$.keySet().iterator();
while ($iter$.hasNext())
{
$type$ $var$ = ($type$) $iter$.next();
$end$
}

Iterate over map values

itmv

Iterator $iter$ = $map$.values().iterator();
while ($iter$.hasNext())
{
$type$ $var$ = ($type$) $iter$.next();
$end$
}

JDBC Connection

conn

public static Connection getConnection() throws SQLException
{
String username = "$end$scott";
String password = "tiger";
String thinConn = "jdbc:oracle:thin:@localhost:1521:ORCL";
Driver d = new OracleDriver();
Connection conn = DriverManager.getConnection(thinConn,username,password);
conn.setAutoCommit(false);
return conn;
}

List to array

itoar

$type$ $var$ = new $typeelem$[$list$.size()];
$var$ = ($type$) $list$.toArray($var$);
$end$

main method

main

public static void main(String[] args)
{
$end$
}

out.println()

outp

out.println($end$);

private ArrayList

pral

private ArrayList _$end$ = new ArrayList();

private boolean

prb

private boolean _$end$;

private HashMap

prhm

private HashMap _$end$ = new HashMap();

private int

pri

private int _$end$;

private String

prs

private String _$end$;

public static final

pusf

public static final $end$;

public static final boolean

pusfb

public static final boolean $end$;

public static final int

pusfi

public static final int $end$;

public static final String

pusfs

public static final String $end$;

Reverse array iterator

ritar

for (int $i$ = $array$.length; --$i$ >= 0 ;)
{
$type$ $var$ = $array$[$i$];
$end$
}

Reverse iteration over a list

ritli

for (int $i$ = $list$.size(); --$i$ >= 0 ; )
{
$type$ $var$ = ($type$) $list$.get($i$);
$end$
}

System.err.println

SEP

System.err.println($end$);

System.out.println

sop

System.out.println($end$);

switch statement

sw

switch ($end$)
{
case XXX:
{

}
break;
default:
{

}
break;
}

try statement

try

try
{
$end$
} catch (Exception ex)
{
ex.printStackTrace();
} finally
{
}

while statement

wh

while ($end$)
{

}

ソース・エディタのコード・テンプレートのカスタマイズ
コード・テンプレートの使用