shohaku.shoin.factory
クラス BindMethodFactory

java.lang.Object
  拡張shohaku.shoin.factory.AbstractResourceSetFactory
      拡張shohaku.shoin.factory.AbstractIOResourceSetFactory
          拡張shohaku.shoin.factory.AbstractGinkgoResourceSetFactory
              拡張shohaku.shoin.factory.BindMethodFactory
すべての実装インタフェース:
GinkgoResourceSetFactory, IOResourceSetFactory, ResourceKeyPrefixSupport, ResourceSetFactory

public class BindMethodFactory
extends AbstractGinkgoResourceSetFactory
implements ResourceKeyPrefixSupport

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.AbstractGinkgoResourceSetFactory から継承したメソッド
findClassLoader, getClassLoader, getDefaultNodeCompositeRule, getDocumentCompositeRule, getNodeCompositeRule, getParentDocument, getParseDocument, getResourceSet, load, load, newResourceSetMap, newResourceSetObject, setClassLoader, setDocumentCompositeRule, setNodeCompositeRule, setParentDocument, setParseDocument
 
クラス 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
 

コンストラクタの詳細

BindMethodFactory

public BindMethodFactory()
プロパティを初期値で初期化します。

メソッドの詳細

initValues

protected void initValues(java.util.Map lookup,
                          shohaku.ginkgo.TagNode root,
                          int index)
クラス AbstractGinkgoResourceSetFactory の記述:
リソースの初期化および登録します。

定義:
クラス AbstractGinkgoResourceSetFactory 内の initValues
パラメータ:
lookup - リソースを格納するマップ
root - ルートタグ
index - IOリソースのインデックス

getPrefix

public java.lang.String getPrefix()
インタフェース ResourceKeyPrefixSupport の記述:
全てのリソースに対する接頭辞を返却します。

定義:
インタフェース ResourceKeyPrefixSupport 内の getPrefix
戻り値:
全てのリソースに対する接頭辞

setPrefix

public void setPrefix(java.lang.String prefix)
インタフェース ResourceKeyPrefixSupport の記述:
全てのリソースに対する接頭辞を格納します。

定義:
インタフェース ResourceKeyPrefixSupport 内の setPrefix
パラメータ:
prefix - 全てのリソースに対する接頭辞

getSourcesPrefix

public java.lang.String[] getSourcesPrefix()
インタフェース ResourceKeyPrefixSupport の記述:
リソース単位での接頭辞の配列を返却します。

定義:
インタフェース ResourceKeyPrefixSupport 内の getSourcesPrefix
戻り値:
リソース単位での接頭辞の配列

setSourcesPrefix

public void setSourcesPrefix(java.lang.String[] prefixs)
インタフェース ResourceKeyPrefixSupport の記述:
リソース単位での接頭辞の配列を格納します。

定義:
インタフェース ResourceKeyPrefixSupport 内の setSourcesPrefix
パラメータ:
prefixs - リソース単位での接頭辞の配列