RequestMethod.Builder methodBuilder = new RequestMethod.Builder(); methodBuilder.setDeclarationMethod(entityProxyType, method); RequestMethod requestMethod = methodBuilder.build(); requestMethods.add(requestMethod);
RequestMethod.Builder methodBuilder = new RequestMethod.Builder(); methodBuilder.setDeclarationMethod(entityProxyType, method); RequestMethod requestMethod = methodBuilder.build(); requestMethods.add(requestMethod);
methodBuilder.setValueType(true); } else if (entityProxyInterface.isAssignableFrom(transportedClass) || valueProxyInterface.isAssignableFrom(transportedClass)) { methodBuilder.setEntityType(getEntityProxyType(transportedClass)); } else if (entityProxyIdInterface.isAssignableFrom(transportedClass)) { JParameterizedType parameterized = transportedClass.isParameterized(); methodBuilder.setEntityType(getEntityProxyType(entityType)); } else if (collectionInterface.isAssignableFrom(transportedClass)) { methodBuilder.setCollectionType(CollectionType.LIST); } else if (setInterface.equals(parameterized.getBaseType())) { methodBuilder.setCollectionType(CollectionType.SET); } else { poison("Requests that return collections may be declared with" + " %s or %s only", methodBuilder.setCollectionElementType(elementType); validateTransportableType(methodBuilder, elementType, requireObject); } else if (mapInterface.isAssignableFrom(transportedClass)) { methodBuilder.setCollectionType(CollectionType.MAP); } else { poison("Requests that return maps may be declared with" + " %s only", mapInterface JClassType keyType = params[0]; JClassType valueType = params[1]; methodBuilder.setMapKeyType(keyType); methodBuilder.setMapValueType(valueType);
methodBuilder.setValueType(true); } else if (entityProxyInterface.isAssignableFrom(transportedClass) || valueProxyInterface.isAssignableFrom(transportedClass)) { methodBuilder.setEntityType(getEntityProxyType(transportedClass)); } else if (entityProxyIdInterface.isAssignableFrom(transportedClass)) { JParameterizedType parameterized = transportedClass.isParameterized(); methodBuilder.setEntityType(getEntityProxyType(entityType)); } else if (collectionInterface.isAssignableFrom(transportedClass)) { methodBuilder.setCollectionType(CollectionType.LIST); } else if (setInterface.equals(parameterized.getBaseType())) { methodBuilder.setCollectionType(CollectionType.SET); } else { poison("Requests that return collections may be declared with" + " %s or %s only", methodBuilder.setCollectionElementType(elementType); validateTransportableType(methodBuilder, elementType, requireObject); } else if (mapInterface.isAssignableFrom(transportedClass)) { methodBuilder.setCollectionType(CollectionType.MAP); } else { poison("Requests that return maps may be declared with" + " %s only", mapInterface JClassType keyType = params[0]; JClassType valueType = params[1]; methodBuilder.setMapKeyType(keyType); methodBuilder.setMapValueType(valueType);
methodBuilder.setInstanceType(getEntityProxyType(params[0])); invocationReturnType = params[1]; } else if (requestInterface.isAssignableFrom(requestReturnType)) { JParameter param = params[i]; paramsOk = validateTransportableType(new RequestMethod.Builder(), param.getType(), false) && paramsOk; if (JBeanMethod.SET.matches(maybeSetter) || JBeanMethod.SET_BUILDER.matches(maybeSetter)) { if (allowSetters) { methodBuilder.addExtraSetter(maybeSetter); } else { poison(noSettersAllowed(maybeSetter));
methodBuilder.setInstanceType(getEntityProxyType(params[0])); invocationReturnType = params[1]; } else if (requestInterface.isAssignableFrom(requestReturnType)) { JParameter param = params[i]; paramsOk = validateTransportableType(new RequestMethod.Builder(), param.getType(), false) && paramsOk; if (JBeanMethod.SET.matches(maybeSetter) || JBeanMethod.SET_BUILDER.matches(maybeSetter)) { if (allowSetters) { methodBuilder.addExtraSetter(maybeSetter); } else { poison(noSettersAllowed(maybeSetter));
/** * Examine a RequestContext subtype to populate a ContextMethod. */ private void buildContextMethod(ContextMethod.Builder contextBuilder, JClassType contextType) throws UnableToCompleteException { Service serviceAnnotation = contextType.getAnnotation(Service.class); ServiceName serviceNameAnnotation = contextType.getAnnotation(ServiceName.class); JsonRpcService jsonRpcAnnotation = contextType.getAnnotation(JsonRpcService.class); if (serviceAnnotation == null && serviceNameAnnotation == null && jsonRpcAnnotation == null) { poison("RequestContext subtype %s is missing a @%s or @%s annotation", contextType .getQualifiedSourceName(), Service.class.getSimpleName(), JsonRpcService.class .getSimpleName()); return; } List<RequestMethod> requestMethods = new ArrayList<RequestMethod>(); for (JMethod method : contextType.getInheritableMethods()) { if (method.getEnclosingType().equals(requestContextInterface)) { // Ignore methods declared in RequestContext continue; } RequestMethod.Builder methodBuilder = new RequestMethod.Builder(); methodBuilder.setDeclarationMethod(contextType, method); if (!validateContextMethodAndSetDataType(methodBuilder, method, jsonRpcAnnotation != null)) { continue; } requestMethods.add(methodBuilder.build()); } contextBuilder.setExtraTypes(checkExtraTypes(contextType, true)).setRequestMethods( requestMethods); }
/** * Examine a RequestContext subtype to populate a ContextMethod. */ private void buildContextMethod(ContextMethod.Builder contextBuilder, JClassType contextType) throws UnableToCompleteException { Service serviceAnnotation = contextType.getAnnotation(Service.class); ServiceName serviceNameAnnotation = contextType.getAnnotation(ServiceName.class); JsonRpcService jsonRpcAnnotation = contextType.getAnnotation(JsonRpcService.class); if (serviceAnnotation == null && serviceNameAnnotation == null && jsonRpcAnnotation == null) { poison("RequestContext subtype %s is missing a @%s or @%s annotation", contextType .getQualifiedSourceName(), Service.class.getSimpleName(), JsonRpcService.class .getSimpleName()); return; } List<RequestMethod> requestMethods = new ArrayList<RequestMethod>(); for (JMethod method : contextType.getInheritableMethods()) { if (method.getEnclosingType().equals(requestContextInterface)) { // Ignore methods declared in RequestContext continue; } RequestMethod.Builder methodBuilder = new RequestMethod.Builder(); methodBuilder.setDeclarationMethod(contextType, method); if (!validateContextMethodAndSetDataType(methodBuilder, method, jsonRpcAnnotation != null)) { continue; } requestMethods.add(methodBuilder.build()); } contextBuilder.setExtraTypes(checkExtraTypes(contextType, true)).setRequestMethods( requestMethods); }