CVS: xdoclet/modules/jdo/src/xdoclet/modules/jdo JdoXmlMetadataSubTask.java,1.15,1.16

Marco Schulze <[email protected]>
Newsgroups gmane.comp.java.xdoclet.devel
Message-ID <[email protected]>
Update of /cvsroot/xdoclet/xdoclet/modules/jdo/src/xdoclet/modules/jdo
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26492/modules/jdo/src/xdoclet/modules/jdo

Modified Files:
	JdoXmlMetadataSubTask.java 
Log Message:
Added project-wide default-fetch-depth (which is overridden by field-tag "fetch-depth").

Index: JdoXmlMetadataSubTask.java
===================================================================
RCS file: /cvsroot/xdoclet/xdoclet/modules/jdo/src/xdoclet/modules/jdo/JdoXmlMetadataSubTask.java,v
retrieving revision 1.15
retrieving revision 1.16
diff -C2 -r1.15 -r1.16
*** JdoXmlMetadataSubTask.java	29 Aug 2005 20:28:50 -0000	1.15
--- JdoXmlMetadataSubTask.java	17 Sep 2005 15:49:34 -0000	1.16
***************
*** 61,64 ****
--- 61,68 ----
      private String  project = "metadata";
  
+     /**
+      * @see   #setFetchDepth(int)
+      */
+     private int     fetchDepth = -1;
  
      /**
***************
*** 80,83 ****
--- 84,95 ----
      }
  
+     /**
+      * @return   Returns the fetch-depth as set by {@link #setFetchDepth(int)} or -1 if nothing was set.
+      */
+     public int getFetchDepth()
+     {
+         return fetchDepth;
+     }
+ 
      public void setProject(String project)
      {
***************
*** 91,94 ****
--- 103,124 ----
  
      /**
+      * The JDO spec defines that a fetch-depth of 1 shall be used if a field has no fetch-depth declared. In case you
+      * don't like this default, you must tag every field with a different fetch-depth. This is an annoying work if you
+      * want to have the same for the majority of your fields. Hence, you have the possibility to declare the <code>fetchDepth</code>
+      * attribute for the <code>jdometadata</code> subtask. This will cause every field to be tagged with this default,
+      * if the field doesn't have a fetch-depth declared. If the field has a fetch-depth, this one is used.
+      *
+      * @param fetchDepth  Either -1 to indicate that no default-fetch-depth should be set, or 0 for infinite depth, or a
+      *      positive number indicating how many levels the detaching shall dive into the object-graph.
+      */
+     public void setFetchDepth(int fetchDepth)
+     {
+         if (fetchDepth < -1)
+             throw new IllegalArgumentException("fetchDepth=" + fetchDepth + " is illegal! Must be -1 to deactivate the default-fetch-depth or a number >= 0!");
+ 
+         this.fetchDepth = fetchDepth;
+     }
+ 
+     /**
       * Called to validate configuration parameters.
       *



-------------------------------------------------------
SF.Net email is sponsored by:
Tame your development challenges with Apache's Geronimo App Server. 
Download it for free - -and be entered to win a 42" plasma tv or your very
own Sony(tm)PSP.  Click here to play: http://sourceforge.net/geronimo.php
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.