Thaks everyone for all the great ideas. I've applied many of the changes suggested in the list. I've also moved the taglibrary into the org.apache.commons.jelly.tags.bcel namespace for future inclusion into the Jelly taglibraries CVS tree. First however, I want to expand upon the Class Extender to attempt to apply some of the ideas that Jouzas suggested in relation to BSF.

The new syntax is outlined in the attached model.xml file.
-Mark Diggory



Attachment: bcel.zip
Description: Binary data

<?xml version="1.0" encoding="UTF-8"?>
<jelly xmlns="jelly:core" xmlns:bcel="jelly:org.apache.commons.jelly.tags.bcel.BcelTagLibrary">
    <!--
     this example still takes over security control of the context's class loader
     and uses it to gain access to the "defineClass" method. This make the class available
      throughout Jelly Interpreter afterwards.

      class:
             name: required (full package name of Class)
             extends: optional (defaults to java.lang.Object)
             classLoader: optional (loader to load the clas into)

       property:
              name: required (name of property, "foo" for setFoo(...))
              type: any primitive or class as a "String".
     -->
    <bcel:class name="org.mrd.test.Test">
        <bcel:property name="stop" type="double"/>
        <bcel:property name="name" type="java.lang.String"/>
    </bcel:class>
    
    <new var="testExample" className="org.mrd.test.Test"/>
    
    <setProperties object="${testExample}" stop="100.0" name="Hello World!"/>
     
      Name: ${testExample.name}
      Stop:   ${testExample.stop}
     
      <!--
      this example creates a new "BCEL" class loader and uses it to define the class.
      BcelClassLoader has a special public method for adding Bcel JavaClasses.
      -->
    <new var="loader" className="org.apache.commons.jelly.tags.bcel.BcelClassLoader"/>
    
    <bcel:class name="org.mrd.test.Test2" extends="java.lang.Object" classLoader="${loader}">
        <bcel:property name="stop" type="double"/>
        <bcel:property name="name" type="java.lang.String"/>
    </bcel:class>
    
    <new var="testExample2" className="org.mrd.test.Test2" classLoader="${loader}"/>
    
    <setProperties object="${testExample2}" stop="100.0" name="Hello World!"/>
     
      Name: ${testExample2.name}
      Stop:   ${testExample2.stop}
     
</jelly>

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to