commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rdon...@apache.org
Subject cvs commit: jakarta-commons/betwixt/xdocs overview.xml
Date Sun, 05 Jan 2003 10:23:07 GMT
rdonkin     2003/01/05 02:23:07

  Modified:    betwixt/src/java/org/apache/commons/betwixt/strategy
                        DefaultPluralStemmer.java PluralStemmer.java
               betwixt/xdocs overview.xml
  Log:
  Added documentation for PluralStemmer strategy. Improve the java docs and added to main
docs.
  
  Revision  Changes    Path
  1.6       +12 -0     jakarta-commons/betwixt/src/java/org/apache/commons/betwixt/strategy/DefaultPluralStemmer.java
  
  Index: DefaultPluralStemmer.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/betwixt/src/java/org/apache/commons/betwixt/strategy/DefaultPluralStemmer.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- DefaultPluralStemmer.java	30 Dec 2002 18:18:37 -0000	1.5
  +++ DefaultPluralStemmer.java	5 Jan 2003 10:23:07 -0000	1.6
  @@ -83,7 +83,19 @@
       protected static Log log = LogFactory.getLog( DefaultPluralStemmer.class );
   
       /**
  +     * <p>Algorithm supports common english plural patterns.</p>
  +     *
  +     * <p>First, common english plural constructions will be tried. 
  +     * If the property doesn't end with <code>'y'</code> then this method will
look for
  +     * a property with which has <code>'es'</code> appended. 
  +     * If the property ends with <code>'y'</code> then a property with the
<code>'y'</code>
  +     * replaced by <code>'ies'</code> will be searched for.</p>
  +     *
  +     * <p>If no matches are found then - if one exists - a property starting with
the 
  +     * singular name will be returned.</p>
  +     * 
        * @return the plural descriptor for the given singular property name
  +     * @return if more than one descriptor matches, then the best match is returned
        */
       public ElementDescriptor findPluralDescriptor( String propertyName, Map map) {
           int foundKeyCount = 0;
  
  
  
  1.3       +4 -1      jakarta-commons/betwixt/src/java/org/apache/commons/betwixt/strategy/PluralStemmer.java
  
  Index: PluralStemmer.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/betwixt/src/java/org/apache/commons/betwixt/strategy/PluralStemmer.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- PluralStemmer.java	30 Dec 2002 18:18:37 -0000	1.2
  +++ PluralStemmer.java	5 Jan 2003 10:23:07 -0000	1.3
  @@ -79,10 +79,13 @@
   public interface PluralStemmer {
   
       /**
  +     * Find the plural descriptor for a singular property.
  +     * 
        * @return the plural descriptor for the given singular property name
  +     * @return <code>null</code> is no matching descriptor can be found 
        * @param propertyName is the singular property name, from the adder method
        * @param map is a map with the keys are the property names of the available
  -     *  descriptors and the values are the descriptors.
  +     *  descriptors and the values are the descriptors. This may not be null.
        */
       ElementDescriptor findPluralDescriptor( String propertyName, Map map );
   
  
  
  
  1.9       +14 -3     jakarta-commons/betwixt/xdocs/overview.xml
  
  Index: overview.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/betwixt/xdocs/overview.xml,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- overview.xml	5 Jan 2003 09:52:22 -0000	1.8
  +++ overview.xml	5 Jan 2003 10:23:07 -0000	1.9
  @@ -286,13 +286,24 @@
   
   <subsection name="Using a custom plural stemmer">
       <p>
  -    In particular, different languages have different ways of 
  +    Betwixt allows this auto-detection of plurals from singulars to be customized.
  +    Implementations of <code>org.apache.commons.betwixt.PluralStemmer</code>
allow different
  +    strategies for this mapping to be plugged into <code>XMLIntrospector</code>.
  +    The strategy used by <code>XMLIntrospector</code> to match singlular properties
and plural methods
  +    is determined by the <code>PluralStemmer</code> property value.
       </p>
  -    
  +
       <p>
  -    Betwixt supports 
  +    One important usage of custom plural stemmers is to support classes with non-english
method names.
  +    A custom <code>PluralStemmer</code> implementation can be created containing
the plural rules for
  +    the language. Betwixt will then be able to recognize matching plural and singular methods.
       </p>
   
  +    <p>
  +    The default implementation supports common english plural patterns and then falls back
to finding
  +    any property that starts with the singular name. For example, it will match a plural
property called
  +    <code>FooBars</code> for a singular property called <code>FooBar</code>.

  +    </p>
   </subsection>
   
   </section>
  
  
  

--
To unsubscribe, e-mail:   <mailto:commons-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:commons-dev-help@jakarta.apache.org>


Mime
View raw message