ibatis-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "takaya yuko (JIRA)" <ibatis-...@incubator.apache.org>
Subject [jira] Commented: (IBATIS-329) capitalized name of bean's property cased error?
Date Wed, 02 Aug 2006 03:17:14 GMT
    [ http://issues.apache.org/jira/browse/IBATIS-329?page=comments#action_12425106 ] 
            
takaya yuko commented on IBATIS-329:
------------------------------------

Thank you for an intelligible answer.
I deal with this as in the past.

> capitalized name of bean's property cased error?
> ------------------------------------------------
>
>                 Key: IBATIS-329
>                 URL: http://issues.apache.org/jira/browse/IBATIS-329
>             Project: iBatis for Java
>          Issue Type: Bug
>          Components: SQL Maps
>    Affects Versions: 2.1.7
>            Reporter: takaya yuko
>
> Hello,
> Using capitalized letter on bean's property-name leads the following
> error: See next stack trace & source, is this valid?
> (conditions)
>       public class A {
>            /* property's name:indexOf(1) == UpperCase */
>            private String eMail;
>            public String getEMail(){
>                return eMail;
>            }
>            public void setEMail(String email) {
>                eMail = email;
>            }
>       }
>         /* use bean as resultMap */
>         <resultMap id="result" class="A">
>           <result property="eMail" column="EMAIL" columnIndex="1"
>                                javaType="java.lang.String"/>
>         </resultMap>
>               <statement id="search_A" resultMap="result">
>                       SELECT
>                           EMAIL
>                       FROM
>                         A_TABLE
>               </statement>
> (results)
> --- Cause: com.ibatis.common.beans.ProbeException:
>       There is no READABLE property named 'eMail' in class 'A'
> (our resolution)
>       public class A {
>           private String eMail;
>           /* method'name:get + property's name */
>           geteMail(){
>              return EMail;
>           }
>            seteMail(String email) {
>                            eMail = email;
>           }
>       }
> iBATIS_DBL-2.1.7.597.zip (iBATIS Java 2.1.7). i suppose
> that this code prevent to exchange "getter-name" to "property-name".
> i took a provisional countermeasure changing "get + property-name"
> (e.g: gateMail), and avoid this error now.
> but i'm not sure whether this changes fits your spec or not.
> could you tell me about that?
> ---com.ibatis.common.beans.ClassInfo----------------------------------
>  private static String dropCase(String name) {
>   if (name.startsWith("is")) {
>     name = name.substring(2);
>   } else if (name.startsWith("get") || name.startsWith("set")) {
>     name = name.substring(3);
>   } else {
>     throw new ProbeException("Error parsing property name '"
>       + name + "'.  Didn't start with 'is', 'get' or 'set'.");
>   }
>   if (name.length() == 1 || (name.length() > 1
>       && !Character.isUpperCase(name.charAt(1)))) { ---------#
>        name = name.substring(0, 1).toLowerCase(Locale.US)
>        + name.substring(1);
>   }
>   return name;
>  }
> ----------------------------------------------------------------------
> thanks in advance,

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Mime
View raw message