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.util.List;
025
026import org.granite.tide.IInvocationCall;
027
028
029/**
030 * @author William DRAI
031 */
032public class InvocationCall implements IInvocationCall {
033
034    private static final long serialVersionUID = 1L;
035    
036    
037    private List<String> listeners;
038    private List<ContextUpdate> updates;
039    private Object[] results;
040    
041    
042    public InvocationCall() {
043    }
044
045    public List<String> getListeners() {
046        return listeners;
047    }
048    public void setListeners(List<String> listeners) {
049        this.listeners = listeners;
050    }
051    
052    public List<ContextUpdate> getUpdates() {
053        return updates;
054    }
055    public void setUpdates(List<ContextUpdate> updates) {
056        this.updates = updates;
057    }
058
059    public Object[] getResults() {
060        return results;
061    }
062    public void setResults(Object[] results) {
063        this.results = results;
064    }
065    
066    
067    @Override
068    public String toString() {
069        StringBuilder sb = new StringBuilder();
070        sb.append(getClass().getName()).append(" {\n");
071        if (listeners != null) {
072                sb.append("\tlisteners: [");
073                for (String listener : listeners)
074                        sb.append(listener).append(" ");
075                sb.append("]\n");
076        }
077        if (updates != null) {
078                sb.append("\tupdates: [");
079                for (ContextUpdate update : updates)
080                        sb.append(update).append(" ");
081                sb.append("]\n");
082        }
083        if (results != null) {
084                sb.append("\tresults: [");
085                for (Object result : results)
086                        sb.append(result != null ? result.toString() : "(null)").append(" ");
087                sb.append("]\n");
088        }
089        sb.append("}");
090        return sb.toString();
091    }
092}