001    /*
002      GRANITE DATA SERVICES
003      Copyright (C) 2011 GRANITE DATA SERVICES S.A.S.
004    
005      This file is part of Granite Data Services.
006    
007      Granite Data Services is free software; you can redistribute it and/or modify
008      it under the terms of the GNU Library General Public License as published by
009      the Free Software Foundation; either version 2 of the License, or (at your
010      option) any later version.
011    
012      Granite Data Services is distributed in the hope that it will be useful, but
013      WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
014      FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License
015      for more details.
016    
017      You should have received a copy of the GNU Library General Public License
018      along with this library; if not, see <http://www.gnu.org/licenses/>.
019    */
020    
021    package org.granite.tide.invocation;
022    
023    import java.util.List;
024    
025    import org.granite.tide.IInvocationCall;
026    
027    
028    /**
029     * @author William DRAI
030     */
031    public class InvocationCall implements IInvocationCall {
032    
033        private static final long serialVersionUID = 1L;
034        
035        
036        private List<String> listeners;
037        private List<ContextUpdate> updates;
038        private Object[] results;
039        
040        
041        public InvocationCall() {
042        }
043    
044        public List<String> getListeners() {
045            return listeners;
046        }
047        public void setListeners(List<String> listeners) {
048            this.listeners = listeners;
049        }
050        
051        public List<ContextUpdate> getUpdates() {
052            return updates;
053        }
054        public void setUpdates(List<ContextUpdate> updates) {
055            this.updates = updates;
056        }
057    
058        public Object[] getResults() {
059            return results;
060        }
061        public void setResults(Object[] results) {
062            this.results = results;
063        }
064        
065        
066        @Override
067        public String toString() {
068            StringBuilder sb = new StringBuilder();
069            sb.append(getClass().getName()).append(" {\n");
070            if (listeners != null) {
071                    sb.append("\tlisteners: [");
072                    for (String listener : listeners)
073                            sb.append(listener).append(" ");
074                    sb.append("]\n");
075            }
076            if (updates != null) {
077                    sb.append("\tupdates: [");
078                    for (ContextUpdate update : updates)
079                            sb.append(update).append(" ");
080                    sb.append("]\n");
081            }
082            if (results != null) {
083                    sb.append("\tresults: [");
084                    for (Object result : results)
085                            sb.append(result != null ? result.toString() : "(null)").append(" ");
086                    sb.append("]\n");
087            }
088            sb.append("}");
089            return sb.toString();
090        }
091    }