View Javadoc

1   /*
2    * Copyright 2004-2008 the Seasar Foundation and the Others.
3    *
4    * Licensed under the Apache License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    *     http://www.apache.org/licenses/LICENSE-2.0
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 
13   * either express or implied. See the License for the specific language
14   * governing permissions and limitations under the License.
15   */
16  package org.seasar.uruma.procedure.entity;
17  
18  import java.util.Collections;
19  import java.util.HashMap;
20  import java.util.Map;
21  import java.util.Set;
22  
23  import org.seasar.uruma.util.AssertionUtil;
24  
25  /**
26   * プロシジャ定義を表すクラスです。<br />
27   * 本クラスはプロシジャ実行定義ファイルの procedure 要素に対応します。<br />
28   * 
29   * @author y-komori
30   */
31  public class Procedure {
32      private String name;
33  
34      private Map<String, String> paramMap = new HashMap<String, String>();
35  
36      /**
37       * 実行するコマンド名称を取得します。<br />
38       * 
39       * @return 実行するコマンド名称
40       */
41      public String getName() {
42          return this.name;
43      }
44  
45      /**
46       * 実行するコマンド名称を設定します。<br />
47       * 
48       * @param name
49       *            実行するコマンド名称
50       */
51      public void setName(final String name) {
52          this.name = name;
53      }
54  
55      /**
56       * コマンドのパラメータを設定します。<br />
57       * 
58       * @param name
59       *            パラメータ名称
60       * @param value
61       *            パラメータ値
62       */
63      public void setParam(final String name, final String value) {
64          AssertionUtil.assertNotNull("name", name);
65          AssertionUtil.assertNotNull("value", value);
66          paramMap.put(name, value);
67      }
68  
69      /**
70       * コマンドのパラメータを取得します。<br />
71       * 
72       * @param name
73       *            パラメータ名称
74       * @return パラメータ値。パラメータが存在しない場合は <code>null</code>。
75       */
76      public String getParam(final String name) {
77          return paramMap.get(name);
78      }
79  
80      /**
81       * パラメータ名の一覧を取得します。<br />
82       * 
83       * @return パラメータ名の {@link Set} オブジェクト。
84       */
85      public Set<String> getParamNames() {
86          return Collections.unmodifiableSet(paramMap.keySet());
87      }
88  }