jp.mosp.common.common
クラス MospUtility

java.lang.Object
  上位を拡張 jp.mosp.common.common.MospUtility

public final class MospUtility
extends Object

MosPアプリケーションを開発する上で有用なメソッドを提供する。


コンストラクタの概要
MospUtility()
           
 
メソッドの概要
static Date addDay(Date date, int amount)
          日操作。
static Date addMonth(Date date, int amount)
          月操作。
static void addResources(Properties pr, String path, String target)
          設定ファイル読込処理(追加)。
static Date addYear(Date date, int amount)
          年操作。
static void convProperties(Properties ppt, String path, String name)
          設定ファイル→JavaScriptファイル変換。
static String encrypt(String value, boolean hasMospSeJar)
          暗号化(mosp-se.jar利用)。
static String generateProcSeq(boolean hasMospSeJar, String stored)
          処理シーケンス発行。
static int getAspFlag(Properties cfg)
          ASP設定取得取得。
static int getCalendarValue(Date date, int field)
          カレンダーによるデータ取得。
static Date getDate(String strDate)
          日付取得。
static String getDateString(Date date, String format)
          日付文字列取得。
static int getDay(Date date)
          日取得。
static String getDigest(String value)
          暗号化(複合不可)。
static int getHour(Date date)
          時間取得。
static Object getInstance(Properties ctl, String key)
          クラスインスタンス取得。
static Object getInstance(String className)
          クラスインスタンス取得。
static String getMessage(Properties msg, String msgCode, String rep)
          メッセージ取得。
static int getMinute(Date date)
          分取得。
static int getMonth(Date date)
          月取得。
static String getMospJarVersion()
          mosp.jarバージョン取得。
static Properties getResource(String path)
          設定ファイル読込処理。
static String getStackTrace(Throwable ex)
          例外スタックトレースを取得する。
static Date getSystemDate()
          システム日付取得。
static int getYear(Date date)
          年取得。
static String replace(String message, String rep)
          メッセージの文字列置換を行う。
static double round(double value, int scale, int mode)
          丸め処理(四捨五入等)。
 
クラス java.lang.Object から継承されたメソッド
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

コンストラクタの詳細

MospUtility

public MospUtility()
メソッドの詳細

getMospJarVersion

public static String getMospJarVersion()
mosp.jarバージョン取得。

戻り値:
mosp.japバージョン

getInstance

public static Object getInstance(Properties ctl,
                                 String key)
                          throws IllegalAccessException,
                                 InstantiationException,
                                 MospException
クラスインスタンス取得。

パラメータ:
ctl - 設定ファイル
key - 設定ファイルに登録されているキー
戻り値:
キーに対応するクラスのインスタンス
例外:
IllegalAccessException
InstantiationException
MosPException
MospException

getInstance

public static Object getInstance(String className)
                          throws IllegalAccessException,
                                 InstantiationException,
                                 MospException
クラスインスタンス取得。

パラメータ:
className - クラス名
戻り値:
対応するクラスのインスタンス
例外:
IllegalAccessException
InstantiationException
MosPException
MospException

getResource

public static Properties getResource(String path)
                              throws IOException
設定ファイル読込処理。

パラメータ:
path - 設定ファイルパス(絶対パス)
戻り値:
設定ファイル
例外:
IOException

addResources

public static void addResources(Properties pr,
                                String path,
                                String target)
                         throws IOException
設定ファイル読込処理(追加)。

pathで指定されるディレクトリからファイル名がtargetで終わるファイルを読み込む。
但し、ファイル名がファイル名がtargetで始まるファイルは対象外とする。
読み込まれるファイルは、ファイル名の昇順。
この際、別ファイルに同じ設定があった場合は、 後に読まれたファイルの設定が有効となる。

パラメータ:
pr - 追加対象プロパティオブジェクト
path - 設定ファイルルートパス(絶対パス)
target - 対象文字列
例外:
IOException

getMessage

public static String getMessage(Properties msg,
                                String msgCode,
                                String rep)
                         throws MospException
メッセージ取得。

パラメータ:
msg - メッセージ一覧
msgCode - メッセージコード
rep - 置換文字列(複数ある場合はカンマ区切り)
戻り値:
メッセージ文字列
例外:
MospException

replace

public static String replace(String message,
                             String rep)
メッセージの文字列置換を行う。

パラメータ:
message - 文字列
rep - 置換文字列(複数ある場合はカンマ区切り)
戻り値:
メッセージ文字列
例外:
MospException

generateProcSeq

public static String generateProcSeq(boolean hasMospSeJar,
                                     String stored)
処理シーケンス発行。

パラメータ:
hasMospSeJar - mosp-se.jar有無
stored - 保存されているProcSeq
戻り値:
処理シーケンス

getDigest

public static String getDigest(String value)
                        throws NoSuchAlgorithmException
暗号化(複合不可)。

パラメータ:
value - 対象文字列
戻り値:
暗号化文字列
例外:
NoSuchAlgorithmException

encrypt

public static String encrypt(String value,
                             boolean hasMospSeJar)
                      throws NoSuchAlgorithmException
暗号化(mosp-se.jar利用)。

パラメータ:
value - 対象文字列
hasMospSeJar - mosp-se.jar有無
戻り値:
暗号化文字列
例外:
NoSuchAlgorithmException

convProperties

public static void convProperties(Properties ppt,
                                  String path,
                                  String name)
                           throws FileNotFoundException,
                                  UnsupportedEncodingException,
                                  IOException
設定ファイル→JavaScriptファイル変換。

パラメータ:
ppt - 設定ファイル
path - 出力ファイルパス
name - オブジェクト名
例外:
FileNotFoundException
UnsupportedEncodingException
IOException

getDate

public static Date getDate(String strDate)
                    throws MospException
日付取得。

パラメータ:
strDate - 日付文字列
戻り値:
日付(Date)
例外:
MospException

getStackTrace

public static String getStackTrace(Throwable ex)
例外スタックトレースを取得する。

パラメータ:
ex - 例外オブジェクト
戻り値:
例外スタックトレース文字列

getAspFlag

public static int getAspFlag(Properties cfg)
                      throws MospException
ASP設定取得取得。

パラメータ:
cfg - 設定ファイル
戻り値:
ASP設定
例外:
MospException

getDateString

public static String getDateString(Date date,
                                   String format)
日付文字列取得。

パラメータ:
date - 時間
format - 時間
戻り値:
時間文字列(HH:MM)

getYear

public static int getYear(Date date)
年取得。

パラメータ:
date - 日付

getMonth

public static int getMonth(Date date)
月取得。

パラメータ:
date - 日付

getDay

public static int getDay(Date date)
日取得。

パラメータ:
date - 日付

getHour

public static int getHour(Date date)
時間取得。

パラメータ:
date - 日付

getMinute

public static int getMinute(Date date)
分取得。

パラメータ:
date - 日付

getCalendarValue

public static int getCalendarValue(Date date,
                                   int field)
カレンダーによるデータ取得。

パラメータ:
date - 日付
field - フィールド

addYear

public static Date addYear(Date date,
                           int amount)
年操作。

パラメータ:
date - 操作日付
amount - 増減年数
戻り値:
操作後日付

addMonth

public static Date addMonth(Date date,
                            int amount)
月操作。

パラメータ:
date - 操作日付
amount - 増減月数
戻り値:
操作後日付

addDay

public static Date addDay(Date date,
                          int amount)
日操作。

パラメータ:
date - 操作日付
amount - 増減日数
戻り値:
操作後日付

getSystemDate

public static Date getSystemDate()
システム日付取得。

戻り値:
システム日付

round

public static double round(double value,
                           int scale,
                           int mode)
丸め処理(四捨五入等)。

パラメータ:
value - 対象値
scale - 対象位置(少数点以下:0で整数)
mode - 方法
例外:
Exception