[jdom-interest] BeanMapper

Alex Chaffee guru at edamame.stinky.com
Tue Sep 26 17:08:20 PDT 2000


Here's the BeanMapper.java source code. Add it to the
jdom-contrib/src/java/org/jdom/contrib/beans directory.

Also, a jdom-contrib/build.xml that loads in jakarta regexp.jar --
find it on the jakarta web site.

 - Alex


-- 
Alex Chaffee                       mailto:alex at jguru.com
jGuru - Java News and FAQs         http://www.jguru.com/alex/
Creator of Gamelan                 http://www.gamelan.com/
Founder of Purple Technology       http://www.purpletech.com/
Curator of Stinky Art Collective   http://www.stinky.com/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: org.jdom.contrib.beans.zip
Type: application/octet-stream
Size: 39444 bytes
Desc: not available
Url : http://jdom.org/pipermail/jdom-interest/attachments/20000926/c1fe2c74/org.jdom.contrib.beans.obj
-------------- next part --------------
<!-- ===========================================================================


Introduction
============

To Be Written


Installing the build tools
==========================

For instructions on JDOM use of Ant see the build.xml find in the "jdom"
module (../jdom).

Build targets
=============

These are the meaningful targets for this build file:

 - package [default] -> creates ./build/jdom-contrib.jar
 - compile -> compiles the contributed source code
 - samples -> compiles the contributed samples
 - javadoc -> generates the API documentation in ./build/javadocs
 - clean -> restores the distribution to its original and clean state

-->

<project default="package" basedir=".">

  <!-- =================================================================== -->
  <!-- Initialization target                                               -->
  <!-- =================================================================== -->
  <target name="init">
    <tstamp/>
    <property name="Name" value="JDOM Contributions"/>
    <property name="name" value="jdom-contrib"/>
    <property name="version" value="1.0 prerelease"/>
    <property name="year" value="2000"/>

    <echo message="----------- ${Name} ${version} [${year}] ------------"/>

    <property name="build.compiler" value="classic"/>
    <property name="debug" value="on"/>
    <property name="optimize" value="on"/>
    <property name="deprecation" value="on"/>

    <property name="src.dir" value="./src/java"/>
    <property name="samples.dir" value="./samples"/>
    <property name="lib.dir" value="./lib"/>
    <property name="packages" value="org.jdom.*"/>

    <property name="build.dir" value="./build"/>
    <property name="build.src" value="./build/src"/>
    <property name="build.dest" value="./build/classes"/>
    <property name="build.javadocs" value="./build/apidocs"/>

    <property name="xpath.parser.dir" value="${build.src}/org/jdom/contrib/xpath/parser/"/>

    <property name="dist.root" value="./dist"/>
    <property name="dist.dir" value="${dist.root}/${name}-${version}"/>

    <filter token="year" value="${year}"/>
    <filter token="version" value="${version}"/>
    <filter token="date" value="${TODAY}"/>
    <filter token="log" value="true"/>
    <filter token="verbose" value="true"/>

    <!-- JDK1.1 collections -->
    <property name="coll.import" value="com.sun.java.util.collections"/>
    <available classname="${coll.import}.Collection" property="coll.present"/>
  </target>

  <!-- =================================================================== -->
  <!-- Help on usage                                                       -->
  <!-- =================================================================== -->
  <target name="usage">
    <echo message=""/>
    <echo message=""/>
    <echo message="JDOM Build file"/>
    <echo message="-------------------------------------------------------------"/>
    <echo message=""/>
    <echo message=" available targets are:"/>
    <echo message=""/>
    <echo message="   package  --> generates the jdom-contrib.jar file (default)"/>
    <echo message="   compile  --> compiles the contributed source code"/>
    <echo message="   samples  --> compiles the contributed samples"/>
    <echo message="   javadoc  --> generates the API documentation (java 1.2 only)"/>
    <echo message="   clean    --> restores the distribution to its clean state"/>
    <echo message=""/>
    <echo message=" See the comments inside the build.xml file for more details."/>
    <echo message="-------------------------------------------------------------"/>
    <echo message=""/>
    <echo message=""/>
  </target>

  <!-- =================================================================== -->
  <!-- Prepares the build directory                                        -->
  <!-- =================================================================== -->
  <target name="prepare" depends="init">
    <mkdir dir="${build.dir}"/>
  </target>

  <!-- =================================================================== -->
  <!-- Prepares the source code                                            -->
  <!-- =================================================================== -->
  <target name="prepare-src" depends="prepare">
    <!-- create directories -->
    <mkdir dir="${build.src}"/>
    <mkdir dir="${build.dest}"/>

    <!-- copy src files -->
    <copydir src="${src.dir}"
             dest="${build.src}"
             filtering="on"/>

    <java fork="yes"
          classname="antlr.Tool"
          jvmargs="-classpath ${java.class.path}"
          args="-o ${xpath.parser.dir} ${xpath.parser.dir}/xpath.g"/>

    <java fork="yes"
          classname="antlr.Tool"
          jvmargs="-classpath ${java.class.path}"
          args="-o ${xpath.parser.dir} ${xpath.parser.dir}/xpath_lexer.g"/>

  </target>

  <!-- =================================================================== -->
  <!-- Does replacement on files for dealing with collections.             -->
  <!-- XXX The efficiency could be improved here; all replacements should  -->
  <!-- XXX happen during one read/write phase and only for files that have -->
  <!-- XXX changed.                                                        -->
  <!-- =================================================================== -->
  <target name="collections" if="coll.present" depends="prepare-src">
    <replace dir="${build.src}" includes="org/**"
             token="java.util.Collection" value="${coll.import}.Collection"/>
    <replace dir="${build.src}" includes="org/**"
             token="java.util.Map" value="${coll.import}.Map"/>
    <replace dir="${build.src}" includes="org/**"
             token="java.util.HashMap" value="${coll.import}.HashMap"/>
    <replace dir="${build.src}" includes="org/**"
             token="java.util.List" value="${coll.import}.List"/>
    <replace dir="${build.src}" includes="org/**"
             token="java.util.LinkedList" value="${coll.import}.LinkedList"/>
    <replace dir="${build.src}" includes="org/**"
             token="java.util.Iterator" value="${coll.import}.Iterator"/>
    <replace dir="${build.src}" includes="org/**"
             token="java.util.ArrayList" value="${coll.import}.ArrayList"/>
    <!-- The following replace handles the "import java.util.*" case by    -->
    <!-- adding an "import com.sun.java.util.collections.*" after it.      -->
    <!-- BTW, \u000a is the Unicode escape for a new line. (jhunter)       -->
    <replace dir="${build.src}" includes="org/**"
             token="java.util.*" 
             value="java.util.*;\u000aimport ${coll.import}.*"/>
  </target>

  <!-- =================================================================== -->
  <!-- Prepares the example code                                           -->
  <!-- =================================================================== -->
  <target name="prepare-samples" depends="prepare">
    <!-- create directories -->
    <mkdir dir="${build.src}"/>
    <mkdir dir="${build.dest}"/>

    <!-- copy src files -->
    <copydir src="${samples.dir}"
             dest="${build.src}"
             filtering="on"/>
  </target>

  <!-- =================================================================== -->
  <!-- Compiles the source directory                                       -->
  <!-- =================================================================== -->
  <target name="compile" depends="prepare-src,collections">
    <!-- Compile the Spitfire demo only if the Spitfire classes are found -->
    <available property="spitfire.present"
     classname="com.XML_Technologies.Spitfire.Parsers.Element" />
    <!-- Compile the JTree demo only if the Swing classes are found -->
    <available property="swing.present"
     classname="javax.swing.tree.DefaultMutableTreeNode" />
    <javac srcdir="${build.src}"
           destdir="${build.dest}"
           debug="${debug}"
           optimize="${optimize}">
      <exclude name="**/Spitfire*.java" unless="spitfire.present" />
      <exclude name="**/*JTree*.java" unless="swing.present" />
    </javac>
  </target>

  <!-- =================================================================== -->
  <!-- Compiles the samples directory                                       -->
  <!-- =================================================================== -->
  <target name="samples" depends="prepare-samples">
    <!-- Compile the Spitfire demo only if the Spitfire classes are found -->
    <available property="spitfire.present"
     classname="com.XML_Technologies.Spitfire.Parsers.Element" />
    <javac srcdir="${build.src}"
           destdir="${build.dest}"
           debug="${debug}"
           optimize="${optimize}">
      <exclude name="**/Spitfire*.java" unless="spitfire.present" />
    </javac>
  </target>

  <!-- =================================================================== -->
  <!-- Creates the class package                                           -->
  <!-- =================================================================== -->
  <target name="package" depends="compile">
    <fixcrlf srcdir="." includes="*.bat" cr="add"/>
    <fixcrlf srcdir="." includes="*.sh" cr="remove"/>
    <jar jarfile="${build.dir}/${name}.jar"
         basedir="${build.dest}"
         includes="org/**"/>
  </target>

  <!-- =================================================================== -->
  <!-- Creates the API documentation                                       -->
  <!-- =================================================================== -->
  <target name="javadoc" depends="prepare-src">
    <mkdir dir="${build.javadocs}"/>
    <javadoc packagenames="${packages}"
             sourcepath="${build.src}"
             destdir="${build.javadocs}"
             author="true"
             version="true"
             use="true"
             splitindex="true"
             noindex="false"
             windowtitle="${Name} API"
             doctitle="${Name}"
             bottom="Copyright &#169; ${year} Brett McLaughlin, Jason Hunter. All Rights Reserved."
    />
  </target>

  <!-- =================================================================== -->
  <!-- Clean targets                                                       -->
  <!-- =================================================================== -->
  <target name="clean" depends="init">
    <deltree dir="${build.dir}"/>
    <delete file="${docs.dir}/changes.xml"/>
    <delete file="${docs.dir}/todo.xml"/>
    <delete file="${docs.dir}/book.xml"/>
  </target>

  <target name="distclean" depends="clean">
    <deltree dir="${dist.root}"/>
    <delete file="${Name}-${version}.tar.gz"/>
    <delete file="${Name}-${version}.tar"/>
    <delete file="${Name}-${version}.zip"/>
  </target>

</project>

<!-- End of file -->


More information about the jdom-interest mailing list