/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. */
  14. package com.googlecode.gwtrpccommlayer.shared;
  15. import com.google.gwt.user.client.rpc.AsyncCallback;
  16. import java.io.Serializable;
  17. import java.lang.reflect.Method;
  18. import java.util.ArrayList;
  19. import java.util.HashMap;
  20. import java.util.LinkedList;
  21. import java.util.List;
  22. /**
  23. * Abstracts the Request made from the GwtRpcCommLayer-Client
  24. * @author jeff mchugh
  25. *
  26. */
  27. public class GwtRpcCommLayerPojoRequest implements Serializable
  28. {
  29. /**
  30. *
  31. */
  32. private static final long serialVersionUID = 6032112000081674584L;
  33. private ArrayList<Serializable> methodParameters = null;
  34. private String methodName = null;
  35. private HashMap<String,String> metaData = null;
  36. //Need to set method parameter classes
  37. private List<String> lstParamClassNames = new LinkedList<String>();
  38. public GwtRpcCommLayerPojoRequest()
  39. {
  40. setMethodParameters( new ArrayList<Serializable>() );
  41. setMetaData(new HashMap<String, String>());
  42. }
  43. /**
  44. * @param methodParameters the methodParameters to set
  45. */
  46. public void setMethodParameters(ArrayList<Serializable> methodParameters)
  47. {
  48. this.methodParameters = methodParameters;
  49. }
  50. /**
  51. * @return the methodParameters
  52. */
  53. public ArrayList<Serializable> getMethodParameters()
  54. {
  55. return methodParameters;
  56. }
  57. /**
  58. * @param methodName the methodName to set
  59. */
  60. public void setMethodName(String methodName)
  61. {
  62. this.methodName = methodName;
  63. }
  64. /**
  65. * @return the methodName
  66. */
  67. public String getMethodName()
  68. {
  69. return methodName;
  70. }
  71. /**
  72. * @param metaData the metaData to set
  73. */
  74. public void setMetaData(HashMap<String,String> metaData)
  75. {
  76. this.metaData = metaData;
  77. }
  78. /**
  79. * @return the metaData
  80. */
  81. public HashMap<String,String> getMetaData()
  82. {
  83. return metaData;
  84. }
  85. public void setMethod(Method method) {
  86. setMethodName(method.getName());
  87. Class<?>[] classes;
  88. for (Class<?> clazz: method.getParameterTypes()) {
  89. //todo: nasty hack, we know enough to clean this up
  90. if (clazz != AsyncCallback.class)
  91. lstParamClassNames.add(clazz.getCanonicalName());
  92. }
  93. }
  94. public List<String> getParameterClassNames() {
  95. return lstParamClassNames;
  96. }
  97. }