com.google.gwt.user.server.rpc.RPC.getSourceRepresentation()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(8.8k)|赞(0)|评价(0)|浏览(266)

本文整理了Java中com.google.gwt.user.server.rpc.RPC.getSourceRepresentation方法的一些代码示例,展示了RPC.getSourceRepresentation的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。RPC.getSourceRepresentation方法的具体详情如下:
包路径:com.google.gwt.user.server.rpc.RPC
类名称:RPC
方法名:getSourceRepresentation

RPC.getSourceRepresentation介绍

[英]Returns the source representation for a method signature.
[中]返回方法签名的源表示形式。

代码示例

代码示例来源:origin: com.google.gwt/gwt-servlet

  1. private static String formatIllegalAccessErrorMessage(Object target, Method serviceMethod) {
  2. StringBuffer sb = new StringBuffer();
  3. sb.append("Blocked attempt to access inaccessible method '");
  4. sb.append(getSourceRepresentation(serviceMethod));
  5. sb.append("'");
  6. if (target != null) {
  7. sb.append(" on target '");
  8. sb.append(printTypeName(target.getClass()));
  9. sb.append("'");
  10. }
  11. sb.append("; this is either misconfiguration or a hack attempt");
  12. return sb.toString();
  13. }

代码示例来源:origin: com.google.gwt/gwt-servlet

  1. private static String formatIllegalArgumentErrorMessage(Object target, Method serviceMethod,
  2. Object[] args) {
  3. StringBuffer sb = new StringBuffer();
  4. sb.append("Blocked attempt to invoke method '");
  5. sb.append(getSourceRepresentation(serviceMethod));
  6. sb.append("'");
  7. if (target != null) {
  8. sb.append(" on target '");
  9. sb.append(printTypeName(target.getClass()));
  10. sb.append("'");
  11. }
  12. sb.append(" with invalid arguments");
  13. if (args != null && args.length > 0) {
  14. sb.append(Arrays.asList(args));
  15. }
  16. return sb.toString();
  17. }

代码示例来源:origin: com.google.gwt/gwt-servlet

  1. public static String encodeResponseForFailure(Method serviceMethod, Throwable cause,
  2. SerializationPolicy serializationPolicy, int flags) throws SerializationException {
  3. if (cause == null) {
  4. throw new NullPointerException("cause cannot be null");
  5. }
  6. if (serializationPolicy == null) {
  7. throw new NullPointerException("serializationPolicy");
  8. }
  9. if (serviceMethod != null && !RPCServletUtils.isExpectedException(serviceMethod, cause)) {
  10. throw new UnexpectedException("Service method '" + getSourceRepresentation(serviceMethod)
  11. + "' threw an unexpected exception: " + cause.toString(), cause);
  12. }
  13. return encodeResponse(cause.getClass(), cause, true, flags, serializationPolicy);
  14. }

代码示例来源:origin: com.google.gwt/gwt-servlet

  1. public static String encodeResponseForSuccess(Method serviceMethod, Object object,
  2. SerializationPolicy serializationPolicy, int flags) throws SerializationException {
  3. if (serviceMethod == null) {
  4. throw new NullPointerException("serviceMethod cannot be null");
  5. }
  6. if (serializationPolicy == null) {
  7. throw new NullPointerException("serializationPolicy");
  8. }
  9. Class<?> methodReturnType = serviceMethod.getReturnType();
  10. if (methodReturnType != void.class && object != null) {
  11. Class<?> actualReturnType;
  12. if (methodReturnType.isPrimitive()) {
  13. actualReturnType = getPrimitiveClassFromWrapper(object.getClass());
  14. } else {
  15. actualReturnType = object.getClass();
  16. }
  17. if (actualReturnType == null || !methodReturnType.isAssignableFrom(actualReturnType)) {
  18. throw new IllegalArgumentException("Type '" + printTypeName(object.getClass())
  19. + "' does not match the return type in the method's signature: '"
  20. + getSourceRepresentation(serviceMethod) + "'");
  21. }
  22. }
  23. return encodeResponse(methodReturnType, object, false, flags, serializationPolicy);
  24. }

代码示例来源:origin: com.vaadin.external.gwt/gwt-user

  1. private static String formatIllegalAccessErrorMessage(Object target, Method serviceMethod) {
  2. StringBuffer sb = new StringBuffer();
  3. sb.append("Blocked attempt to access inaccessible method '");
  4. sb.append(getSourceRepresentation(serviceMethod));
  5. sb.append("'");
  6. if (target != null) {
  7. sb.append(" on target '");
  8. sb.append(printTypeName(target.getClass()));
  9. sb.append("'");
  10. }
  11. sb.append("; this is either misconfiguration or a hack attempt");
  12. return sb.toString();
  13. }

代码示例来源:origin: net.wetheinter/gwt-user

  1. private static String formatIllegalAccessErrorMessage(Object target, Method serviceMethod) {
  2. StringBuffer sb = new StringBuffer();
  3. sb.append("Blocked attempt to access inaccessible method '");
  4. sb.append(getSourceRepresentation(serviceMethod));
  5. sb.append("'");
  6. if (target != null) {
  7. sb.append(" on target '");
  8. sb.append(printTypeName(target.getClass()));
  9. sb.append("'");
  10. }
  11. sb.append("; this is either misconfiguration or a hack attempt");
  12. return sb.toString();
  13. }

代码示例来源:origin: com.vaadin.external.gwt/gwt-user

  1. private static String formatIllegalArgumentErrorMessage(Object target, Method serviceMethod,
  2. Object[] args) {
  3. StringBuffer sb = new StringBuffer();
  4. sb.append("Blocked attempt to invoke method '");
  5. sb.append(getSourceRepresentation(serviceMethod));
  6. sb.append("'");
  7. if (target != null) {
  8. sb.append(" on target '");
  9. sb.append(printTypeName(target.getClass()));
  10. sb.append("'");
  11. }
  12. sb.append(" with invalid arguments");
  13. if (args != null && args.length > 0) {
  14. sb.append(Arrays.asList(args));
  15. }
  16. return sb.toString();
  17. }

代码示例来源:origin: net.wetheinter/gwt-user

  1. private static String formatIllegalArgumentErrorMessage(Object target, Method serviceMethod,
  2. Object[] args) {
  3. StringBuffer sb = new StringBuffer();
  4. sb.append("Blocked attempt to invoke method '");
  5. sb.append(getSourceRepresentation(serviceMethod));
  6. sb.append("'");
  7. if (target != null) {
  8. sb.append(" on target '");
  9. sb.append(printTypeName(target.getClass()));
  10. sb.append("'");
  11. }
  12. sb.append(" with invalid arguments");
  13. if (args != null && args.length > 0) {
  14. sb.append(Arrays.asList(args));
  15. }
  16. return sb.toString();
  17. }

代码示例来源:origin: net.wetheinter/gwt-user

  1. public static String encodeResponseForFailure(Method serviceMethod, Throwable cause,
  2. SerializationPolicy serializationPolicy, int flags) throws SerializationException {
  3. if (cause == null) {
  4. throw new NullPointerException("cause cannot be null");
  5. }
  6. if (serializationPolicy == null) {
  7. throw new NullPointerException("serializationPolicy");
  8. }
  9. if (serviceMethod != null && !RPCServletUtils.isExpectedException(serviceMethod, cause)) {
  10. throw new UnexpectedException("Service method '" + getSourceRepresentation(serviceMethod)
  11. + "' threw an unexpected exception: " + cause.toString(), cause);
  12. }
  13. return encodeResponse(cause.getClass(), cause, true, flags, serializationPolicy);
  14. }

代码示例来源:origin: com.vaadin.external.gwt/gwt-user

  1. public static String encodeResponseForFailure(Method serviceMethod, Throwable cause,
  2. SerializationPolicy serializationPolicy, int flags) throws SerializationException {
  3. if (cause == null) {
  4. throw new NullPointerException("cause cannot be null");
  5. }
  6. if (serializationPolicy == null) {
  7. throw new NullPointerException("serializationPolicy");
  8. }
  9. if (serviceMethod != null && !RPCServletUtils.isExpectedException(serviceMethod, cause)) {
  10. throw new UnexpectedException("Service method '" + getSourceRepresentation(serviceMethod)
  11. + "' threw an unexpected exception: " + cause.toString(), cause);
  12. }
  13. return encodeResponse(cause.getClass(), cause, true, flags, serializationPolicy);
  14. }

代码示例来源:origin: net.wetheinter/gwt-user

  1. public static String encodeResponseForSuccess(Method serviceMethod, Object object,
  2. SerializationPolicy serializationPolicy, int flags) throws SerializationException {
  3. if (serviceMethod == null) {
  4. throw new NullPointerException("serviceMethod cannot be null");
  5. }
  6. if (serializationPolicy == null) {
  7. throw new NullPointerException("serializationPolicy");
  8. }
  9. Class<?> methodReturnType = serviceMethod.getReturnType();
  10. if (methodReturnType != void.class && object != null) {
  11. Class<?> actualReturnType;
  12. if (methodReturnType.isPrimitive()) {
  13. actualReturnType = getPrimitiveClassFromWrapper(object.getClass());
  14. } else {
  15. actualReturnType = object.getClass();
  16. }
  17. if (actualReturnType == null || !methodReturnType.isAssignableFrom(actualReturnType)) {
  18. throw new IllegalArgumentException("Type '" + printTypeName(object.getClass())
  19. + "' does not match the return type in the method's signature: '"
  20. + getSourceRepresentation(serviceMethod) + "'");
  21. }
  22. }
  23. return encodeResponse(methodReturnType, object, false, flags, serializationPolicy);
  24. }

代码示例来源:origin: com.vaadin.external.gwt/gwt-user

  1. public static String encodeResponseForSuccess(Method serviceMethod, Object object,
  2. SerializationPolicy serializationPolicy, int flags) throws SerializationException {
  3. if (serviceMethod == null) {
  4. throw new NullPointerException("serviceMethod cannot be null");
  5. }
  6. if (serializationPolicy == null) {
  7. throw new NullPointerException("serializationPolicy");
  8. }
  9. Class<?> methodReturnType = serviceMethod.getReturnType();
  10. if (methodReturnType != void.class && object != null) {
  11. Class<?> actualReturnType;
  12. if (methodReturnType.isPrimitive()) {
  13. actualReturnType = getPrimitiveClassFromWrapper(object.getClass());
  14. } else {
  15. actualReturnType = object.getClass();
  16. }
  17. if (actualReturnType == null || !methodReturnType.isAssignableFrom(actualReturnType)) {
  18. throw new IllegalArgumentException("Type '" + printTypeName(object.getClass())
  19. + "' does not match the return type in the method's signature: '"
  20. + getSourceRepresentation(serviceMethod) + "'");
  21. }
  22. }
  23. return encodeResponse(methodReturnType, object, false, flags, serializationPolicy);
  24. }

相关文章