jstrachan 2002/09/24 09:49:40
Modified: jelly/src/java/org/apache/commons/jelly/tags/ant
AntTagLibrary.java
jelly/src/java/org/apache/commons/jelly TagLibrary.java
Log:
Minor refactor to add the String -> File converter to the standard Jelly libraries
rather than leaving it in the Ant tag library.
Revision Changes Path
1.22 +0 -17
jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/tags/ant/AntTagLibrary.java
Index: AntTagLibrary.java
===================================================================
RCS file:
/home/cvs/jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/tags/ant/AntTagLibrary.java,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -r1.21 -r1.22
--- AntTagLibrary.java 23 Sep 2002 12:35:22 -0000 1.21
+++ AntTagLibrary.java 24 Sep 2002 16:49:40 -0000 1.22
@@ -61,8 +61,6 @@
*/
package org.apache.commons.jelly.tags.ant;
-import java.io.File;
-
import org.apache.commons.beanutils.ConvertUtils;
import org.apache.commons.beanutils.Converter;
import org.apache.commons.grant.GrantProject;
@@ -101,21 +99,6 @@
// register standard converters for Ant types
- ConvertUtils.register(
- new Converter() {
- public Object convert(Class type, Object value) {
- if ( value instanceof File ) {
- return (File) value;
- }
- else if ( value != null ) {
- String text = value.toString();
- return new File( text );
- }
- return null;
- }
- },
- File.class
- );
ConvertUtils.register(
new Converter() {
1.14 +30 -5
jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/TagLibrary.java
Index: TagLibrary.java
===================================================================
RCS file:
/home/cvs/jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/TagLibrary.java,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- TagLibrary.java 5 Sep 2002 16:43:29 -0000 1.13
+++ TagLibrary.java 24 Sep 2002 16:49:40 -0000 1.14
@@ -62,9 +62,13 @@
package org.apache.commons.jelly;
+import java.io.File;
import java.util.HashMap;
import java.util.Map;
+import org.apache.commons.beanutils.ConvertUtils;
+import org.apache.commons.beanutils.Converter;
+
import org.apache.commons.jelly.expression.CompositeExpression;
import org.apache.commons.jelly.expression.ConstantExpression;
import org.apache.commons.jelly.expression.Expression;
@@ -82,6 +86,27 @@
public abstract class TagLibrary {
private Map tags = new HashMap();
+
+ static {
+
+ // register standard converters
+
+ ConvertUtils.register(
+ new Converter() {
+ public Object convert(Class type, Object value) {
+ if ( value instanceof File ) {
+ return (File) value;
+ }
+ else if ( value != null ) {
+ String text = value.toString();
+ return new File( text );
+ }
+ return null;
+ }
+ },
+ File.class
+ );
+ }
public TagLibrary() {
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>