r1912 - in trunk/src: main/java/org/nuiton/util/beans test/java/org/nuiton/util/beans
Author: tchemit Date: 2010-08-29 16:47:34 +0200 (Sun, 29 Aug 2010) New Revision: 1912 Url: http://nuiton.org/repositories/revision/nuiton-utils/1912 Log: add headers + clean BeanUtil Modified: trunk/src/main/java/org/nuiton/util/beans/BeanMonitor.java trunk/src/main/java/org/nuiton/util/beans/BeanUtil.java trunk/src/test/java/org/nuiton/util/beans/BeanMonitorTest.java Modified: trunk/src/main/java/org/nuiton/util/beans/BeanMonitor.java =================================================================== --- trunk/src/main/java/org/nuiton/util/beans/BeanMonitor.java 2010-08-29 14:39:36 UTC (rev 1911) +++ trunk/src/main/java/org/nuiton/util/beans/BeanMonitor.java 2010-08-29 14:47:34 UTC (rev 1912) @@ -1,3 +1,27 @@ +/* + * #%L + * Nuiton Utils + * + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2004 - 2010 CodeLutin + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 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 Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * #L% + */ package org.nuiton.util.beans; import org.apache.commons.logging.Log; Modified: trunk/src/main/java/org/nuiton/util/beans/BeanUtil.java =================================================================== --- trunk/src/main/java/org/nuiton/util/beans/BeanUtil.java 2010-08-29 14:39:36 UTC (rev 1911) +++ trunk/src/main/java/org/nuiton/util/beans/BeanUtil.java 2010-08-29 14:47:34 UTC (rev 1912) @@ -1,20 +1,34 @@ +/* + * #%L + * Nuiton Utils + * + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2004 - 2010 CodeLutin + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 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 Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * #L% + */ package org.nuiton.util.beans; import org.apache.commons.beanutils.MethodUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import java.beans.PropertyChangeEvent; import java.beans.PropertyChangeListener; import java.lang.reflect.InvocationTargetException; -import java.util.Arrays; -import java.util.Collections; -import java.util.HashSet; -import java.util.List; -import java.util.Set; -import static org.nuiton.i18n.I18n._; - /** * Usefull methods around the {@link PropertyChangeListener}. * @@ -22,7 +36,10 @@ * @since 1.4.1 */ public class BeanUtil { + public static final String ADD_PROPERTY_CHANGE_LISTENER = "addPropertyChangeListener"; + public static final String REMOVE_PROPERTY_CHANGE_LISTENER = "removePropertyChangeListener"; + protected BeanUtil() { // no instance } @@ -45,7 +62,7 @@ public static void addPropertyChangeListener(PropertyChangeListener listener, Object bean) throws InvocationTargetException, NoSuchMethodException, IllegalAccessException { MethodUtils.invokeExactMethod(bean, - "addPropertyChangeListener", + ADD_PROPERTY_CHANGE_LISTENER, new Object[]{listener}, new Class[]{PropertyChangeListener.class} ); @@ -69,7 +86,7 @@ public static void removePropertyChangeListener(PropertyChangeListener listener, Object bean) throws InvocationTargetException, NoSuchMethodException, IllegalAccessException { MethodUtils.invokeExactMethod(bean, - "removePropertyChangeListener", + REMOVE_PROPERTY_CHANGE_LISTENER, new Object[]{listener}, new Class[]{PropertyChangeListener.class} ); Modified: trunk/src/test/java/org/nuiton/util/beans/BeanMonitorTest.java =================================================================== --- trunk/src/test/java/org/nuiton/util/beans/BeanMonitorTest.java 2010-08-29 14:39:36 UTC (rev 1911) +++ trunk/src/test/java/org/nuiton/util/beans/BeanMonitorTest.java 2010-08-29 14:47:34 UTC (rev 1912) @@ -1,3 +1,27 @@ +/* + * #%L + * Nuiton Utils + * + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2004 - 2010 CodeLutin + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 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 Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * #L% + */ package org.nuiton.util.beans; import org.junit.Assert;
participants (1)
-
tchemit@users.nuiton.org