|
|||||||||||
前のクラス 次のクラス | フレームあり フレームなし | ||||||||||
概要: 入れ子 | フィールド | コンストラクタ | メソッド | 詳細: フィールド | コンストラクタ | メソッド |
java.lang.Objectshohaku.shoin.factory.AbstractResourceSetFactory
shohaku.shoin.factory.AbstractIOResourceSetFactory
shohaku.shoin.factory.AbstractGinkgoResourceSetFactory
shohaku.shoin.factory.ComponentFactory
XMLデータで定義された情報を基に、POJOを生成するファクトリを提供します。
例:
// 湖を表現するオブジェクト public class Lake { private String name; public static Lake(String name) { this.name = name; } public String getName() { return name; } public void setName(String name) { this.name = name; } } //定義ファイル component-factory.xml <component-factory> <!-- コンポーネントの定義、グループ名="lake", シングルトン --> <components name="lake"> <component id="constructorId" name="constructor" class="Lake" instance="singleton"> <init> <arg><string>支笏湖</string></arg> </init> </component> <component id="propertyId" name="property" class="Lake" instance="singleton"> <property name="name"> <string>阿寒湖</string> </property> </component> <component id="methodId" name="method" class="Lake" instance="singleton"> <method name="setName"> <arg><string>倶多楽湖</string></arg> </method> </component> </components> <!-- コンポーネントを参照する、グループ名="ref", プロトタイプ(要求ごとに新規生成する) --> <components name="ref"> <!-- コンポーネントを参照してリストを生成します --> <component name="list" class="java.util.ArrayList" instance="prototype"> <method name="add"> <arg><ref>constructorId</ref></arg> </method> <method name="add"> <arg><ref>propertyId</ref></arg> </method> <method name="add"> <arg><ref>methodId</ref></arg> </method> </component> </components> <component-factory> グループ名とコンポーネント名を ':' で区切りコンポーネント識別子として認識されます。 一般的なファイルの読み取りとコンポーネント取得の手順は以下の様に為ります。 ComponentFactory factory = new ComponentFactory(); IOResource inres = FeatureFactory.getLoader().getIOResource("component-factory.xml"); factory.setIOResources(new IOResource[] { inres }); ResourceSet resources = factory.getResourceSet(); Lake lake = (Lake) resources.getObject("lake:constructor"); List list = (List) resources.getObject("ref:list"); System.out.println("湖名=" + lake.getName()); System.out.println("リスト=" + list.toString()); >>湖名=支笏湖 >>リスト=[支笏湖, 阿寒湖, 倶多楽湖]
コンストラクタの概要 | |
ComponentFactory()
プロパティを初期値で初期化します。 |
メソッドの概要 | |
java.lang.String |
getPrefix()
全てのリソースに対する接頭辞を返却します。 |
java.lang.String[] |
getSourcesPrefix()
リソース単位での接頭辞の配列を返却します。 |
protected void |
initValues(java.util.Map lookup,
shohaku.ginkgo.TagNode root,
int index)
リソースの初期化および登録します。 |
protected ResourceSet |
newResourceSetObject(java.util.Map lookup)
マップからリソース集合を生成して返却します。 |
void |
setPrefix(java.lang.String prefix)
全てのリソースに対する接頭辞を格納します。 |
void |
setSourcesPrefix(java.lang.String[] prefixs)
リソース単位での接頭辞の配列を格納します。 |
クラス shohaku.shoin.factory.AbstractIOResourceSetFactory から継承したメソッド |
getIOResources, setIOResources |
クラス java.lang.Object から継承したメソッド |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
インタフェース shohaku.shoin.IOResourceSetFactory から継承したメソッド |
getIOResources, setIOResources |
コンストラクタの詳細 |
public ComponentFactory()
メソッドの詳細 |
protected ResourceSet newResourceSetObject(java.util.Map lookup)
AbstractGinkgoResourceSetFactory
内の newResourceSetObject
lookup
- リソースを格納するマップ
protected void initValues(java.util.Map lookup, shohaku.ginkgo.TagNode root, int index) throws shohaku.ginkgo.GinkgoException
AbstractGinkgoResourceSetFactory
の記述:
AbstractGinkgoResourceSetFactory
内の initValues
lookup
- リソースを格納するマップroot
- ルートタグindex
- IOリソースのインデックス
shohaku.ginkgo.GinkgoException
public java.lang.String getPrefix()
ResourceKeyPrefixSupport
の記述:
ResourceKeyPrefixSupport
内の getPrefix
public void setPrefix(java.lang.String prefix)
ResourceKeyPrefixSupport
の記述:
ResourceKeyPrefixSupport
内の setPrefix
prefix
- 全てのリソースに対する接頭辞public java.lang.String[] getSourcesPrefix()
ResourceKeyPrefixSupport
の記述:
ResourceKeyPrefixSupport
内の getSourcesPrefix
public void setSourcesPrefix(java.lang.String[] prefixs)
ResourceKeyPrefixSupport
の記述:
ResourceKeyPrefixSupport
内の setSourcesPrefix
prefixs
- リソース単位での接頭辞の配列
|
|||||||||||
前のクラス 次のクラス | フレームあり フレームなし | ||||||||||
概要: 入れ子 | フィールド | コンストラクタ | メソッド | 詳細: フィールド | コンストラクタ | メソッド |