本文整理匯總了Java中com.googlecode.jsonrpc4j.JsonRpcService.value方法的典型用法代碼示例。如果您正苦於以下問題:Java JsonRpcService.value方法的具體用法?Java JsonRpcService.value怎麽用?Java JsonRpcService.value使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.googlecode.jsonrpc4j.JsonRpcService
的用法示例。
在下文中一共展示了JsonRpcService.value方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: findServiceBeanDefinitions
import com.googlecode.jsonrpc4j.JsonRpcService; //導入方法依賴的package包/類
/**
* Finds the beans to expose and puts them in the {@link #serviceBeanNames}
* map.
* <p>
* Searches parent factories as well.
*/
private void findServiceBeanDefinitions(
ConfigurableListableBeanFactory beanFactory) {
for (String beanName : beanFactory.getBeanDefinitionNames()) {
JsonRpcService jsonRpcPath = beanFactory.findAnnotationOnBean(beanName, JsonRpcService.class);
if (jsonRpcPath != null) {
String pathValue = jsonRpcPath.value();
LOG.debug(format("Found JSON-RPC path '%s' for bean [%s].",
pathValue, beanName));
if (serviceBeanNames.containsKey(pathValue)) {
String otherBeanName = serviceBeanNames.get(pathValue);
LOG.warn(format(
"Duplicate JSON-RPC path specification: found %s on both [%s] and [%s].",
pathValue, beanName, otherBeanName));
}
serviceBeanNames.put(pathValue, beanName);
}
}
BeanFactory parentBeanFactory = beanFactory.getParentBeanFactory();
if (parentBeanFactory != null
&& ConfigurableListableBeanFactory.class.isInstance(parentBeanFactory)) {
findServiceBeanDefinitions((ConfigurableListableBeanFactory) parentBeanFactory);
}
}
示例2: analyzeController
import com.googlecode.jsonrpc4j.JsonRpcService; //導入方法依賴的package包/類
/**
* Analyze controller and search resource
*
* @param controllerClazz
* class
* @param resourceMap
* map of result
* @param description
* description
* @return return result map
*/
private Map<String, SpringResource> analyzeController(Class<?> controllerClazz,
Map<String, SpringResource> resourceMap, String description) {
JsonRpcService serviceAnnotation =
AnnotationUtils.findAnnotation(controllerClazz, JsonRpcService.class);
if (serviceAnnotation != null) {
String requestUrl = serviceAnnotation.value();
for (Method method : controllerClazz.getMethods()) {
JsonRpcMethod jsonRpcMethod =
AnnotationUtils.findAnnotation(method, JsonRpcMethod.class);
if (jsonRpcMethod != null) {
// It is necessary to modify as few methods able to live on the same url in
// swagger
String resourceKey = controllerClazz.getCanonicalName() + requestUrl + ' '
+ jsonRpcMethod.value();
if (!resourceMap.containsKey(resourceKey)) {
SpringResource springResource = new SpringResource(controllerClazz,
requestUrl, resourceKey, description);
springResource.setControllerMapping(requestUrl);
resourceMap.put(resourceKey, springResource);
}
resourceMap.get(resourceKey).addMethod(method);
}
}
}
return resourceMap;
}
示例3: findServiceBeanDefinitions
import com.googlecode.jsonrpc4j.JsonRpcService; //導入方法依賴的package包/類
/**
* Finds the beans to expose
* map.
* <p>
* Searches parent factories as well.
*/
private static Map<String, String> findServiceBeanDefinitions(ConfigurableListableBeanFactory beanFactory) {
final Map<String, String> serviceBeanNames = new HashMap<>();
for (String beanName : beanFactory.getBeanDefinitionNames()) {
JsonRpcService jsonRpcPath = beanFactory.findAnnotationOnBean(beanName, JsonRpcService.class);
if (hasServiceAnnotation(jsonRpcPath)) {
String pathValue = jsonRpcPath.value();
logger.debug("Found JSON-RPC path '{}' for bean [{}].", pathValue, beanName);
if (isNotDuplicateService(serviceBeanNames, beanName, pathValue))
serviceBeanNames.put(pathValue, beanName);
}
}
collectFromParentBeans(beanFactory, serviceBeanNames);
return serviceBeanNames;
}