You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by jk...@apache.org on 2003/11/04 00:53:14 UTC
cvs commit: jakarta-commons-sandbox/cli/src/java/org/apache/commons/cli2/defaults/impl MessagesBundle.properties PreferencesImpl.java PropertiesImpl.java
jkeyes 2003/11/03 15:53:14
Modified: cli/src/java/org/apache/commons/cli2/defaults/impl
PreferencesImpl.java PropertiesImpl.java
Added: cli/src/java/org/apache/commons/cli2/defaults/impl
MessagesBundle.properties
Log:
- i18n work
Revision Changes Path
1.2 +22 -5 jakarta-commons-sandbox/cli/src/java/org/apache/commons/cli2/defaults/impl/PreferencesImpl.java
Index: PreferencesImpl.java
===================================================================
RCS file: /home/cvs/jakarta-commons-sandbox/cli/src/java/org/apache/commons/cli2/defaults/impl/PreferencesImpl.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- PreferencesImpl.java 2 Nov 2003 22:14:03 -0000 1.1
+++ PreferencesImpl.java 3 Nov 2003 23:53:14 -0000 1.2
@@ -63,23 +63,40 @@
import java.util.prefs.Preferences;
import org.apache.commons.cli2.defaults.Defaults;
+import org.apache.commons.cli2.resources.ResourceHelper;
/**
* @author John Keyes
*/
public class PreferencesImpl implements Defaults {
+ /** i18n */
+ private ResourceHelper resources =
+ ResourceHelper.getResourceHelper(PreferencesImpl.class);
+
+ /** store */
private Preferences prefs;
+ /**
+ * @see org.apache.commons.cli2.defaults.Defaults#init(java.lang.Object)
+ */
public void init(final Object configuration) {
+
+ // the configuration object is not a Preferences
if (!(configuration instanceof Preferences)) {
- throw new IllegalArgumentException("not a prefs");
+ throw new IllegalArgumentException(
+ resources.getMessage(
+ "PreferencesImpl.error.configuration",
+ configuration.getClass().getName()));
}
this.prefs = (Preferences) configuration;
}
- public String get(String name) {
+ /**
+ * @see org.apache.commons.cli2.defaults.Defaults#get(java.lang.String)
+ */
+ public String get(final String name) {
return prefs.get(name, null);
}
}
1.2 +22 -5 jakarta-commons-sandbox/cli/src/java/org/apache/commons/cli2/defaults/impl/PropertiesImpl.java
Index: PropertiesImpl.java
===================================================================
RCS file: /home/cvs/jakarta-commons-sandbox/cli/src/java/org/apache/commons/cli2/defaults/impl/PropertiesImpl.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- PropertiesImpl.java 2 Nov 2003 22:14:03 -0000 1.1
+++ PropertiesImpl.java 3 Nov 2003 23:53:14 -0000 1.2
@@ -63,23 +63,40 @@
import java.util.Properties;
import org.apache.commons.cli2.defaults.Defaults;
+import org.apache.commons.cli2.resources.ResourceHelper;
/**
* @author John Keyes
*/
public class PropertiesImpl implements Defaults {
+ /** i18n */
+ private ResourceHelper resources =
+ ResourceHelper.getResourceHelper(PropertiesImpl.class);
+
+ /** store */
private Properties properties;
+ /**
+ * @see org.apache.commons.cli2.defaults.Defaults#init(java.lang.Object)
+ */
public void init(final Object configuration) {
+
+ // the configuration object is not a Properties
if (!(configuration instanceof Properties)) {
- throw new IllegalArgumentException("not a props");
+ throw new IllegalArgumentException(
+ resources.getMessage(
+ "PropertiesImpl.error.configuration",
+ configuration.getClass().getName()));
}
this.properties = (Properties) configuration;
}
- public String get(String name) {
+ /**
+ * @see org.apache.commons.cli2.defaults.Defaults#get(java.lang.String)
+ */
+ public String get(final String name) {
return properties.getProperty(name);
}
1.1 jakarta-commons-sandbox/cli/src/java/org/apache/commons/cli2/defaults/impl/MessagesBundle.properties
Index: MessagesBundle.properties
===================================================================
PropertiesImpl.error.configuration = The specified configuration object "{0}" is not a java.util.Properties instance.
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org