You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by js...@apache.org on 2002/09/05 18:43:29 UTC
cvs commit: jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly TagLibrary.java
jstrachan 2002/09/05 09:43:29
Modified: jelly/src/java/org/apache/commons/jelly/impl
DynamicTagLibrary.java
jelly/src/java/org/apache/commons/jelly TagLibrary.java
Log:
An intial patch at starting to refactor a little the contract between TagScript and TagLibrary. Hopefully we can make this a little simpler in future.
Revision Changes Path
1.3 +1 -5 jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/impl/DynamicTagLibrary.java
Index: DynamicTagLibrary.java
===================================================================
RCS file: /home/cvs/jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/impl/DynamicTagLibrary.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- DynamicTagLibrary.java 5 Sep 2002 13:31:35 -0000 1.2
+++ DynamicTagLibrary.java 5 Sep 2002 16:43:29 -0000 1.3
@@ -105,11 +105,7 @@
// delegate to my parent instead
if ( answer == null && parent != null ) {
- // #### this is a bit ugly.
- // #### maybe we could refactor this so that a TagScript
- // #### is constructed from a TagFactory instance
- TagScript tagScript = parent.createTagScript(name, attributes);
- return tagScript.getTag();
+ return parent.createTag(name, attributes);
}
return answer;
}
1.13 +18 -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.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- TagLibrary.java 1 Aug 2002 09:53:18 -0000 1.12
+++ TagLibrary.java 5 Sep 2002 16:43:29 -0000 1.13
@@ -98,7 +98,20 @@
return null;
}
+
+ /** Creates a new Tag for the given tag name and attributes */
+ public Tag createTag(String name, Attributes attributes)
+ throws Exception {
+ Class type = (Class) tags.get(name);
+ if ( type != null ) {
+ return (Tag) type.newInstance();
+ }
+ return null;
+
+ }
+
+
/** Allows taglibs to use their own expression evaluation mechanism */
public Expression createExpression(
ExpressionFactory factory,
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>