public class DateFormatWrapper<T extends Date> extends AbstractTextFormatter<T>
DateFormat。validationMessage| コンストラクタと説明 |
|---|
DateFormatWrapper(Class<T> type)
日時のクラス型を指定してインスタンスを作成するコンストラクタ。
|
DateFormatWrapper(DateFormat formatter,
Class<T> type)
フォーマッタを指定してインスタンスを作成するコンストラクタ。
|
| 修飾子とタイプ | メソッドと説明 |
|---|---|
Map<String,Object> |
getMessageVariables()
パース時のエラーメッセージ中の変数を取得します。
|
Optional<String> |
getPattern()
書式を取得します。
|
T |
parse(String text)
文字列をパースして、オブジェクトに変換する。
|
String |
print(Date date)
日時オブジェクトを文字列にフォーマットします。
|
getValidationMessage, setValidationMessagepublic DateFormatWrapper(DateFormat formatter, Class<T> type)
formatter - 日時のフォーマッタ。type - 対応する日時のクラス。NullPointerException - if formatter is null.public DateFormatWrapper(Class<T> type)
書式は、指定したクラスタイプによりにより、自動的に決まります。
type - 日時型のクラスタイプ。NullPointerException - if dateClass is null.public String print(Date date)
date - 日時オブジェクト。public T parse(String text) throws TextParseException
TextParser実装する際には、API経由などでパースした際に発生した例外は、TextParseExceptionでラップするしてください。
TextParseExceptionでラップすると、ParseProcessorでエラーオブジェクトに変換されます。
text - パース対象の文字列。TextParseException - パースに失敗した際にスローされます。public Optional<String> getPattern()
TextParserpublic Map<String,Object> getMessageVariables()
TextParserCopyright © 2025 mygreen. All rights reserved.