diff options
Diffstat (limited to 'jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/listener/SingleMethodReflectiveChangeListener.java')
-rw-r--r-- | jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/listener/SingleMethodReflectiveChangeListener.java | 61 |
1 files changed, 0 insertions, 61 deletions
diff --git a/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/listener/SingleMethodReflectiveChangeListener.java b/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/listener/SingleMethodReflectiveChangeListener.java deleted file mode 100644 index 9602b84b67..0000000000 --- a/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/listener/SingleMethodReflectiveChangeListener.java +++ /dev/null @@ -1,61 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.utility.internal.model.listener; - -import java.lang.reflect.Method; - -import org.eclipse.jpt.utility.internal.ClassTools; -import org.eclipse.jpt.utility.internal.model.event.PropertyChangeEvent; -import org.eclipse.jpt.utility.internal.model.event.StateChangeEvent; - -/** - * This class is used by ReflectiveChangeListener when the requested listener - * need only implement a single method (i.e. StateChangeListener or - * PropertyChangeListener). - */ -class SingleMethodReflectiveChangeListener - extends ReflectiveChangeListener - implements StateChangeListener, PropertyChangeListener -{ - - /** the method we will invoke on the target object */ - private final Method method; - /** cache the number of arguments */ - private final boolean methodIsZeroArgument; - - SingleMethodReflectiveChangeListener(Object target, Method method) { - super(target); - this.method = method; - this.methodIsZeroArgument = method.getParameterTypes().length == 0; - } - - - // ********** StateChangeListener implementation ********** - - public void stateChanged(StateChangeEvent event) { - if (this.methodIsZeroArgument) { - ClassTools.executeMethod(this.method, this.target, EMPTY_STATE_CHANGE_EVENT_ARRAY); - } else { - ClassTools.executeMethod(this.method, this.target, new StateChangeEvent[] {event}); - } - } - - - // ********** PropertyChangeListener implementation ********** - - public void propertyChanged(PropertyChangeEvent event) { - if (this.methodIsZeroArgument) { - ClassTools.executeMethod(this.method, this.target, EMPTY_PROPERTY_CHANGE_EVENT_ARRAY); - } else { - ClassTools.executeMethod(this.method, this.target, new PropertyChangeEvent[] {event}); - } - } - -} |