Author: tchemit Date: 2008-05-14 16:56:40 +0000 (Wed, 14 May 2008) New Revision: 800 Added: branches/lutinutil-sans-vcs/lutinutil/src/java/org/codelutin/util/config/Property.java Modified: branches/lutinutil-sans-vcs/lutinutil/src/java/org/codelutin/util/config/IdentityConfigProperty.java branches/lutinutil-sans-vcs/lutinutil/src/java/org/codelutin/util/config/SimpleConfig.java Log: propri?\195?\169t?\195?\169 typ?\195?\169 + r?\195?\169cup?\195?\169ration Modified: branches/lutinutil-sans-vcs/lutinutil/src/java/org/codelutin/util/config/IdentityConfigProperty.java =================================================================== --- branches/lutinutil-sans-vcs/lutinutil/src/java/org/codelutin/util/config/IdentityConfigProperty.java 2008-05-13 23:02:14 UTC (rev 799) +++ branches/lutinutil-sans-vcs/lutinutil/src/java/org/codelutin/util/config/IdentityConfigProperty.java 2008-05-14 16:56:40 UTC (rev 800) @@ -20,16 +20,26 @@ * @author chemit * @see IdentityConfig */ -public enum IdentityConfigProperty { +public enum IdentityConfigProperty implements Property{ /** property <code>name</code>, first name of user */ - firstName, + firstName(String.class), /** property <code>type</code>, lastname of user */ - lastName, + lastName(String.class), /** property <code>email</code>, email of user */ - email + email(String.class); + private Class<?> type; + //TODO add locale + encoding + + public Class<?> getType() { + return type; + } + + IdentityConfigProperty(Class<?> type) { + this.type = type; + } } \ No newline at end of file Added: branches/lutinutil-sans-vcs/lutinutil/src/java/org/codelutin/util/config/Property.java =================================================================== --- branches/lutinutil-sans-vcs/lutinutil/src/java/org/codelutin/util/config/Property.java (rev 0) +++ branches/lutinutil-sans-vcs/lutinutil/src/java/org/codelutin/util/config/Property.java 2008-05-14 16:56:40 UTC (rev 800) @@ -0,0 +1,21 @@ +/** + * # #% Copyright (C) 2008 Code Lutin, Tony Chemit + * This program is free software; you + * can redistribute it and/or modify it under the terms of the GNU General + * Public License as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. This program is + * distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A + * PARTICULAR PURPOSE. See the GNU General Public License for more details. You + * should have received a copy of the GNU General Public License along with this + * program; if not, write to the Free Software Foundation, Inc., 59 Temple Place + * - Suite 330, Boston, MA 02111-1307, USA. + * # #% + */ +package org.codelutin.util.config; + +/** @author chemit */ +public interface Property { + + Class<?> getType(); +} Modified: branches/lutinutil-sans-vcs/lutinutil/src/java/org/codelutin/util/config/SimpleConfig.java =================================================================== --- branches/lutinutil-sans-vcs/lutinutil/src/java/org/codelutin/util/config/SimpleConfig.java 2008-05-13 23:02:14 UTC (rev 799) +++ branches/lutinutil-sans-vcs/lutinutil/src/java/org/codelutin/util/config/SimpleConfig.java 2008-05-14 16:56:40 UTC (rev 800) @@ -15,6 +15,7 @@ package org.codelutin.util.config; import org.apache.commons.beanutils.BeanUtils; +import org.apache.commons.beanutils.BeanUtilsBean; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; @@ -67,10 +68,13 @@ } public void setProperty(E key, Object value) { - if (value == null && properties.containsKey(key)) { - // never keep a reference on a null value property - properties.remove(key); + if (value == null) { + if (properties.containsKey(key)) { + // never keep a reference on a null value property + properties.remove(key); + } } else { + log.info("key:" + key + ", value:" + value + ", type:" + value.getClass().getSimpleName()); properties.put(key, value); } } @@ -84,7 +88,7 @@ for (E key : keys) { Object value = null; try { - value = BeanUtils.getProperty(src, key.name()); + value = BeanUtilsBean.getInstance().getPropertyUtils().getProperty(src, key.name()); setProperty(key, value); } catch (Exception e) { //TODO