shohaku.shoin.factory
クラス XMLProperties

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

public class XMLProperties
extends AbstractGinkgoResourceSetFactory
implements ResourceKeyPrefixSupport

XMLで定義された、’/’ で区切られた階層名を持つプロパティセットを生成するファクトリを提供します。

例:

 <xml-properties>
     <content>         
         <byte name="byte">-123</byte>
         <double name="double">+1,521,414.012411</double>
         <int name="int">100</int>
         <string name="string">文字列</string>
         <ns name="foo">
             <list id="season" desc="四季">
                 <string>春</ref>
                 <string>夏</ref>
                 <string>秋</ref>
                 <string>冬</ref>
             </list>
         </ns">
     </content>
 </xml-properties>
 
は以下の様に '/' で区切られた名前階層パスにマッピングされ生成されます。
 /byte   = -123
 /double = 1521414.012411
 /int    = 100
 /string = "文字列"
 /foo/season = ["春", "夏", "秋", "冬"]
 
有効な階層の深さは定義ファイルで変更出来ますが、デフォルトは4階層です。
 一般的なファイルの読み取りとコンポーネント取得の手順は以下の様に為ります。 
 XMLProperties factory = new XMLProperties();
 IOResource inres = FeatureFactory.getLoader().getIOResource("properties.xml");
 factory.setIOResources(new IOResource[] { inres });
 
 ResourceSet resources = factory.getResourceSet();

 List list = (List) resources.getObject("/foo/season");
 System.out.println("リスト=" + list.toString());

 >>リスト=["春", "夏", "秋", "冬"]
 


コンストラクタの概要
XMLProperties()
          プロパティを初期値で初期化します。
 
メソッドの概要
 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
 

コンストラクタの詳細

XMLProperties

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

メソッドの詳細

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 - リソース単位での接頭辞の配列