001 // Copyright 2004, 2005 The Apache Software Foundation 002 // 003 // Licensed under the Apache License, Version 2.0 (the "License"); 004 // you may not use this file except in compliance with the License. 005 // You may obtain a copy of the License at 006 // 007 // http://www.apache.org/licenses/LICENSE-2.0 008 // 009 // Unless required by applicable law or agreed to in writing, software 010 // distributed under the License is distributed on an "AS IS" BASIS, 011 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 012 // See the License for the specific language governing permissions and 013 // limitations under the License. 014 015 package org.apache.tapestry.engine; 016 017 import org.apache.hivemind.util.Defense; 018 import org.apache.tapestry.IDirectEvent; 019 020 /** 021 * Parameter object used by {@link org.apache.tapestry.engine.DirectEventService}. 022 * 023 * @author jkuhnert 024 * @since 4.1 025 */ 026 public class DirectEventServiceParameter 027 { 028 protected IDirectEvent _direct; 029 030 protected Object[] _serviceParameters; 031 032 protected String[] _updateParts; 033 034 protected boolean _json; 035 036 public DirectEventServiceParameter(IDirectEvent direct) 037 { 038 this(direct, null, null, false); 039 } 040 041 public DirectEventServiceParameter(IDirectEvent direct, Object[] serviceParameters) 042 { 043 this(direct, serviceParameters, null, false); 044 } 045 046 /** 047 * Creates a new direct service parameter map. 048 * 049 * @param direct The object implementing the direct triggerable interface 050 * @param serviceParameters The parameters for the triggered object 051 * @param updateParts The parts expected to be updated on any returned response 052 * triggerd by this direct call. 053 */ 054 public DirectEventServiceParameter(IDirectEvent direct, Object[] serviceParameters, 055 String[] updateParts, boolean json) 056 { 057 Defense.notNull(direct, "direct"); 058 059 _direct = direct; 060 _serviceParameters = serviceParameters; 061 _updateParts = updateParts; 062 _json = json; 063 } 064 065 public IDirectEvent getDirect() 066 { 067 return _direct; 068 } 069 070 public Object[] getServiceParameters() 071 { 072 return _serviceParameters; 073 } 074 075 public String[] getUpdateParts() 076 { 077 return _updateParts; 078 } 079 080 public boolean isJSON() 081 { 082 return _json; 083 } 084 }