PageRenderTime 13ms CodeModel.GetById 7ms app.highlight 4ms RepoModel.GetById 1ms app.codeStats 0ms

/gwtrpccommlayer/src/main/java/com/googlecode/gwtrpccommlayer/shared/GwtRpcCommLayerPojoRequest.java

https://code.google.com/p/gwtrpccommlayer/
Java | 113 lines | 56 code | 16 blank | 41 comment | 3 complexity | 4519085509fc2c508f71a69d83fe66db MD5 | raw file
  1/*
  2 * Copyright 2010 Jeff McHugh (Segue Development LLC)
  3 * 
  4 * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
  5 * in compliance with the License. You may obtain a copy of the License at
  6 * 
  7 * http://www.apache.org/licenses/LICENSE-2.0
  8 * 
  9 * Unless required by applicable law or agreed to in writing, software distributed under the License
 10 * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
 11 * or implied. See the License for the specific language governing permissions and limitations under
 12 * the License.
 13 */
 14package com.googlecode.gwtrpccommlayer.shared;
 15
 16import com.google.gwt.user.client.rpc.AsyncCallback;
 17
 18import java.io.Serializable;
 19import java.lang.reflect.Method;
 20import java.util.ArrayList;
 21import java.util.HashMap;
 22import java.util.LinkedList;
 23import java.util.List;
 24
 25/**
 26 * Abstracts the Request made from the GwtRpcCommLayer-Client
 27 * @author jeff mchugh
 28 *
 29 */
 30public class GwtRpcCommLayerPojoRequest implements Serializable
 31{
 32	/**
 33	 * 
 34	 */
 35	private static final long	serialVersionUID	= 6032112000081674584L;
 36
 37	private ArrayList<Serializable> methodParameters 	= null;
 38	private String methodName							= null;
 39	private HashMap<String,String> metaData 			= null;
 40
 41    //Need to set method parameter classes
 42    private List<String> lstParamClassNames = new LinkedList<String>();
 43
 44	
 45	public GwtRpcCommLayerPojoRequest()
 46	{
 47		setMethodParameters( new ArrayList<Serializable>() );
 48		setMetaData(new HashMap<String, String>());
 49	}
 50
 51	/**
 52	 * @param methodParameters the methodParameters to set
 53	 */
 54	public void setMethodParameters(ArrayList<Serializable> methodParameters)
 55	{
 56		this.methodParameters = methodParameters;
 57	}
 58
 59	/**
 60	 * @return the methodParameters
 61	 */
 62	public ArrayList<Serializable> getMethodParameters()
 63	{
 64		return methodParameters;
 65	}
 66
 67	/**
 68	 * @param methodName the methodName to set
 69	 */
 70	public void setMethodName(String methodName)
 71	{
 72		this.methodName = methodName;
 73	}
 74
 75	/**
 76	 * @return the methodName
 77	 */
 78	public String getMethodName()
 79	{
 80		return methodName;
 81	}
 82
 83	/**
 84	 * @param metaData the metaData to set
 85	 */
 86	public void setMetaData(HashMap<String,String> metaData)
 87	{
 88		this.metaData = metaData;
 89	}
 90
 91	/**
 92	 * @return the metaData
 93	 */
 94	public HashMap<String,String> getMetaData()
 95	{
 96		return metaData;
 97	}
 98
 99    public void setMethod(Method method) {
100        setMethodName(method.getName());
101        Class<?>[] classes;
102        for (Class<?> clazz: method.getParameterTypes()) {
103            //todo: nasty hack, we know enough to clean this up
104            if (clazz != AsyncCallback.class)
105             lstParamClassNames.add(clazz.getCanonicalName());
106        }
107    }
108
109    public List<String> getParameterClassNames() {
110        return lstParamClassNames;
111    }
112	
113}