|
|||||||||||
前のクラス 次のクラス | フレームあり フレームなし | ||||||||||
概要: 入れ子 | フィールド | コンストラクタ | メソッド | 詳細: フィールド | コンストラクタ | メソッド |
java.lang.Objectshohaku.shoin.factory.AbstractResourceSetFactory
shohaku.shoin.factory.AbstractIOResourceSetFactory
shohaku.shoin.factory.AbstractGinkgoResourceSetFactory
shohaku.shoin.factory.BindMethodFactory
XMLデータで定義された情報を基に、メソッドを特殊な規則で拘束する機能を生成するファクトリを提供します。
このクラスは shohaku.sugina.binder.BindMethod をXMLデータから生成し、識別子でマッピングします。
例:
//関連づけるクラス public class Convert { public static Number toDecimal(String num, String pattern) { final DecimalFormat format = new DecimalFormat(pattern); return format.parse(num); } } //定義ファイル bind-method-factory.xml <component-factory> <bind-method-factory> <bind-method-mapping groupId="convert"> <bind-method id="decimal" name="toDecimal" class="Convert"> <bind-arg name="value" type="String"/> <bind-arg name="pattern" type="String" final="true"> <string>###,###,###</string> </bind-arg> </bind-method> </bind-method-mapping> </bind-method-factory> BindMethodFactory factory = new BindMethodFactory(); final IOResource inres = new ClassPathIOResource("bind-method-factory.xml"); factory.setIOResources(new IOResource[] { inres }); ResourceSet rset = factory.getResourceSet(); BindMethod bindMethod = (BindMethod) rset.getObject("convert:decimal"); // groupId:methodId の識別子で取得する Number num = (Number) bindMethod.invoke(Collections.singletonMap("value", "123,456,789")); //名前で値を関連付けメソッドを実行する System.out.println("変換結果=" + num); >>変換結果=123456789
コンストラクタの概要 | |
BindMethodFactory()
プロパティを初期値で初期化します。 |
メソッドの概要 | |
java.lang.String |
getPrefix()
全てのリソースに対する接頭辞を返却します。 |
java.lang.String[] |
getSourcesPrefix()
リソース単位での接頭辞の配列を返却します。 |
protected void |
initValues(java.util.Map lookup,
shohaku.ginkgo.TagNode root,
int index)
リソースの初期化および登録します。 |
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 BindMethodFactory()
メソッドの詳細 |
protected void initValues(java.util.Map lookup, shohaku.ginkgo.TagNode root, int index)
AbstractGinkgoResourceSetFactory
の記述:
AbstractGinkgoResourceSetFactory
内の initValues
lookup
- リソースを格納するマップroot
- ルートタグindex
- IOリソースのインデックス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
- リソース単位での接頭辞の配列
|
|||||||||||
前のクラス 次のクラス | フレームあり フレームなし | ||||||||||
概要: 入れ子 | フィールド | コンストラクタ | メソッド | 詳細: フィールド | コンストラクタ | メソッド |