public class ResourceBundleEditor extends PropertyEditorSupportSE
ResourceBundles
SE の PropertyEditor
SE 実装。文字列のみからではなく、文字列への変換をサポートしています。XML ベースのメタデータを使用して(適切に構成された)Spring コンテナーでこのクラスを使用するいくつかの例を以下に示します。
<bean id="errorDialog" class="..."> <!-- the 'messages' property is of type java.util.ResourceBundle. the 'DialogMessages.properties' file exists at the root of the CLASSPATH --> <property name="messages" value="DialogMessages"/> </bean>
<bean id="errorDialog" class="..."> <!-- the 'DialogMessages.properties' file exists in the 'com/messages' package --> <property name="messages" value="com/messages/DialogMessages"/> </bean>
「適切に構成された」Spring container
には、変換が透過的に行われるように CustomEditorConfigurer
定義が含まれている場合があります。
<bean class="org.springframework.beans.factory.config.CustomEditorConfigurer"> <property name="customEditors"> <map> <entry key="java.util.ResourceBundle"> <bean class="org.springframework.beans.propertyeditors.ResourceBundleEditor"/> </entry> </map> </property> </bean>
この PropertyEditor
SE は、デフォルトではどの Spring インフラストラクチャにも登録されていないことに注意してください。
提案と最初のプロトタイプを提供してくれた David Leal Valmana に感謝します。
修飾子と型 | フィールドと説明 |
---|---|
static StringSE | BASE_NAME_SEPARATOR converting from a String の場合、ベース名とロケール(存在する場合)を区別するために使用されるセパレータ。 |
コンストラクターと説明 |
---|
ResourceBundleEditor() |
修飾子と型 | メソッドと説明 |
---|---|
void | setAsText(StringSE text) |
addPropertyChangeListenerSE, firePropertyChangeSE, getAsTextSE, getCustomEditorSE, getJavaInitializationStringSE, getSourceSE, getTagsSE, getValueSE, isPaintableSE, paintValueSE, removePropertyChangeListenerSE, setSourceSE, setValueSE, supportsCustomEditorSE
cloneSE, equalsSE, finalizeSE, getClassSE, hashCodeSE, notifySE, notifyAllSE, toStringSE, waitSE, waitSE, waitSE
public static final StringSE BASE_NAME_SEPARATOR
converting from a String
の場合、ベース名とロケール(存在する場合)を区別するために使用されるセパレータ。public void setAsText(StringSE text) throws IllegalArgumentExceptionSE
PropertyEditorSE
の setAsTextSE
PropertyEditorSupportSE
の setAsTextSE
IllegalArgumentExceptionSE