The Jakarta Project < Velocity Tools - Library >

Velocity Tools

Generic Tools

ツールドキュメント

その他のサブプロジェクト

ToolLoader リファレンスドキュメント
       

A view tool that allows template designers to load view tools from within the template. Any object with a public constructor without parameters can be loaded into the context. This tool is considered by the developers to be merely a development tool and inappropriate for use in a production setting.

このビューツールは、テンプレートデザイナがテンプレートの内部からビューツールをロードすることを可能にします。 このツールを用いることで、引数無しの public コンストラクタを持つあらゆるオブジェクトをコンテキスト内にロードすることができます。 このツールは単なる開発ツールであり、本番環境での利用は推奨しません。

Class
 org.apache.velocity.tools.generic.ToolLoader
Name
 $toolLoader (Velocityコンテキスト内での推奨名)
Toolbox設定例
 
<tool>
  <key>toolLoader</key>
  <scope>application</scope>
  <class>org.apache.velocity.tools.generic.ToolLoader</class>
</tool>
作者
 Gabriel Sidler
Method Overview
load() Loads an instance of a tool and returns it.
Method Overview
load() ツールのインスタンスをロードし返却します。
load()
       

Loads an instance of a tool and returns it.

void load(String class)

Parameters
class
The name of the class to instantiate.

example:


#set( $math = $toolLoader.load("org.apache.velocity.tools.generic.MathTool") )
$math.random(1,1000)

Loads MathTool with name $math into the context. Then, its random() function is used to generate a random number between 1 and 1000.


ツールのインスタンスをロードし返却します。

void load(String class)

Parameters
class
インスタンス化するクラス名。

例:


#set( $math = $toolLoader.load("org.apache.velocity.tools.generic.MathTool") )
$math.random(1,1000)

MathTool を $math という名前でコンテキストへロードします。 この random() 関数は、1から1000までのランダムな数字を生成します。



[訳注: この文書は 木村 貴由 高橋 達男 が翻訳しました。 日本語訳に対するコメントがあれば、report@jajakarta.orgに送って下さい。]
Copyright © 1999-2003, Apache Software Foundation