001/**
002 *   GRANITE DATA SERVICES
003 *   Copyright (C) 2006-2013 GRANITE DATA SERVICES S.A.S.
004 *
005 *   This file is part of the Granite Data Services Platform.
006 *
007 *   Granite Data Services is free software; you can redistribute it and/or
008 *   modify it under the terms of the GNU Lesser General Public
009 *   License as published by the Free Software Foundation; either
010 *   version 2.1 of the License, or (at your option) any later version.
011 *
012 *   Granite Data Services is distributed in the hope that it will be useful,
013 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
014 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser
015 *   General Public License for more details.
016 *
017 *   You should have received a copy of the GNU Lesser General Public
018 *   License along with this library; if not, write to the Free Software
019 *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
020 *   USA, or see <http://www.gnu.org/licenses/>.
021 */
022package org.granite.tide.invocation;
023
024import java.io.Serializable;
025import java.util.Arrays;
026
027
028/**
029 * @author William DRAI
030 */
031public class ContextEvent implements Serializable {
032
033    private static final long serialVersionUID = 1L;
034    
035    
036    private String eventType;
037    private Object[] params;
038    
039    
040    public ContextEvent() {
041    }
042    
043    public ContextEvent(String eventType, Object[] params) {
044        this.eventType = eventType;
045        this.params = params;
046    }
047
048    public String getEventType() {
049        return eventType;
050    }
051    public void setEventType(String eventType) {
052        this.eventType = eventType;
053    }
054    
055    public Object[] getParams() {
056        return params;
057    }
058    public void setParams(Object[] params) {
059        this.params = params;
060    }
061
062    @Override
063    public String toString() {
064        return eventType;
065    }
066
067    
068    @Override
069    public int hashCode() {
070        return eventType.hashCode() + 31*Arrays.hashCode(params);
071    }
072    
073    @Override
074    public boolean equals(Object object) {
075        if (object == null || !object.getClass().equals(ContextEvent.class))
076            return false;
077        
078        ContextEvent event = (ContextEvent)object;
079        if (!event.getEventType().equals(eventType))
080            return false;
081        
082        return Arrays.equals(event.getParams(), params);
083    }
084}