public void doWith(Method method) throws IllegalArgumentException, IllegalAccessException { T key = getLookupKeyForMethod(method); if (key != null) { registerEndpoint(key, new MethodEndpoint(beanName, getApplicationContext(), method)); } }
/** * Lookup an endpoint for the given message. The extraction of the endpoint key is delegated to the concrete * subclass. * * @return the looked up endpoint, or {@code null} * @see #getLookupKeyForMessage(MessageContext) */ @Override protected Object getEndpointInternal(MessageContext messageContext) throws Exception { T key = getLookupKeyForMessage(messageContext); if (key == null) { return null; } if (logger.isDebugEnabled()) { logger.debug("Looking up endpoint for [" + key + "]"); } return lookupEndpoint(key); }
public void doWith(Method method) throws IllegalArgumentException, IllegalAccessException { List<T> keys = getLookupKeysForMethod(method); for (T key : keys) { registerEndpoint(key, new MethodEndpoint(endpoint, method)); } } });
/** * Helper method that registers the methods of the given class. This method iterates over the methods of the class, * and calls {@link #getLookupKeyForMethod(Method)} for each. If this returns a string, the method is registered * using {@link #registerEndpoint(Object, MethodEndpoint)}. * * @see #getLookupKeyForMethod(Method) * @see #getLookupKeysForMethod(Method) */ protected void registerMethods(String beanName) { Assert.hasText(beanName, "'beanName' must not be empty"); Class<?> endpointType = getApplicationContext().getType(beanName); endpointType = ClassUtils.getUserClass(endpointType); Set<Method> methods = findEndpointMethods(endpointType, new ReflectionUtils.MethodFilter() { public boolean matches(Method method) { return !getLookupKeysForMethod(method).isEmpty(); } }); for (Method method : methods) { List<T> keys = getLookupKeysForMethod(method); for (T key : keys) { registerEndpoint(key, new MethodEndpoint(beanName, getApplicationContext(), method)); } } }
public void doWith(Method method) throws IllegalArgumentException, IllegalAccessException { T key = getLookupKeyForMethod(method); if (key != null) { registerEndpoint(key, new MethodEndpoint(endpoint, method)); } } });
@Override protected void initApplicationContext() throws BeansException { super.initApplicationContext(); if (logger.isDebugEnabled()) { logger.debug("Looking for endpoints in application context: " + getApplicationContext()); } String[] beanNames = (this.detectEndpointsInAncestorContexts ? BeanFactoryUtils.beanNamesForTypeIncludingAncestors(getApplicationContext(), Object.class) : getApplicationContext().getBeanNamesForType(Object.class)); for (String beanName : beanNames) { Class<?> endpointClass = getApplicationContext().getType(beanName); if (endpointClass != null && AnnotationUtils.findAnnotation(endpointClass, getEndpointAnnotationType()) != null) { registerMethods(beanName); } } }
/** * Helper method that registers the methods of the given bean. This method iterates over the methods of the bean, * and calls {@link #getLookupKeyForMethod(Method)} for each. If this returns a string, the method is registered * using {@link #registerEndpoint(T,MethodEndpoint)}. * * @see #getLookupKeyForMethod(Method) */ protected void registerMethods(final Object endpoint) { Assert.notNull(endpoint, "'endpoint' must not be null"); Class<?> endpointClass = getEndpointClass(endpoint); ReflectionUtils.doWithMethods(endpointClass, new ReflectionUtils.MethodCallback() { public void doWith(Method method) throws IllegalArgumentException, IllegalAccessException { T key = getLookupKeyForMethod(method); if (key != null) { registerEndpoint(key, new MethodEndpoint(endpoint, method)); } } }); }
/** * Returns the endpoint keys for the given method. Should return an empty array if the method is not to be * registered. The default delegates to {@link #getLookupKeysForMethod(Method)}. * * @param method the method * @return a list of registration keys * @since 2.2 */ protected List<T> getLookupKeysForMethod(Method method) { T key = getLookupKeyForMethod(method); return key != null ? Collections.singletonList(key) : Collections.<T>emptyList(); }
/** * Helper method that registers the methods of the given class. This method iterates over the methods of the class, * and calls {@link #getLookupKeyForMethod(Method)} for each. If this returns a string, the method is registered * using {@link #registerEndpoint(String,MethodEndpoint)}. * * @see #getLookupKeyForMethod(Method) */ protected void registerMethods(final String beanName) { Assert.hasText(beanName, "'beanName' must not be empty"); Class<?> endpointClass = getApplicationContext().getType(beanName); ReflectionUtils.doWithMethods(endpointClass, new ReflectionUtils.MethodCallback() { public void doWith(Method method) throws IllegalArgumentException, IllegalAccessException { T key = getLookupKeyForMethod(method); if (key != null) { registerEndpoint(key, new MethodEndpoint(beanName, getApplicationContext(), method)); } } }); }
public boolean matches(Method method) { return !getLookupKeysForMethod(method).isEmpty(); } });
/** * Helper method that registers the methods of the given class. This method iterates over the methods of the class, * and calls {@link #getLookupKeyForMethod(Method)} for each. If this returns a string, the method is registered * using {@link #registerEndpoint(Object, MethodEndpoint)}. * * @see #getLookupKeyForMethod(Method) * @see #getLookupKeysForMethod(Method) */ protected void registerMethods(String beanName) { Assert.hasText(beanName, "'beanName' must not be empty"); Class<?> endpointType = getApplicationContext().getType(beanName); endpointType = ClassUtils.getUserClass(endpointType); Set<Method> methods = findEndpointMethods(endpointType, new ReflectionUtils.MethodFilter() { public boolean matches(Method method) { return !getLookupKeysForMethod(method).isEmpty(); } }); for (Method method : methods) { List<T> keys = getLookupKeysForMethod(method); for (T key : keys) { registerEndpoint(key, new MethodEndpoint(beanName, getApplicationContext(), method)); } } }
@Override protected void initApplicationContext() throws BeansException { super.initApplicationContext(); if (logger.isDebugEnabled()) { logger.debug("Looking for endpoints in application context: " + getApplicationContext()); } String[] beanNames = (this.detectEndpointsInAncestorContexts ? BeanFactoryUtils.beanNamesForTypeIncludingAncestors(getApplicationContext(), Object.class) : getApplicationContext().getBeanNamesForType(Object.class)); for (String beanName : beanNames) { Class<?> endpointClass = getApplicationContext().getType(beanName); if (endpointClass != null && AnnotationUtils.findAnnotation(endpointClass, getEndpointAnnotationType()) != null) { registerMethods(beanName); } } }
/** * Helper method that registers the methods of the given bean. This method iterates over the methods of the bean, * and calls {@link #getLookupKeyForMethod(Method)} for each. If this returns a string, the method is registered * using {@link #registerEndpoint(Object, MethodEndpoint)}. * * @see #getLookupKeyForMethod(Method) */ protected void registerMethods(final Object endpoint) { Assert.notNull(endpoint, "'endpoint' must not be null"); Class<?> endpointClass = getEndpointClass(endpoint); ReflectionUtils.doWithMethods(endpointClass, new ReflectionUtils.MethodCallback() { public void doWith(Method method) throws IllegalArgumentException, IllegalAccessException { List<T> keys = getLookupKeysForMethod(method); for (T key : keys) { registerEndpoint(key, new MethodEndpoint(endpoint, method)); } } }); }
/** * Returns the endpoint keys for the given method. Should return an empty array if the method is not to be * registered. The default delegates to {@link #getLookupKeysForMethod(Method)}. * * @param method the method * @return a list of registration keys * @since 2.2 */ protected List<T> getLookupKeysForMethod(Method method) { T key = getLookupKeyForMethod(method); return key != null ? Collections.singletonList(key) : Collections.<T>emptyList(); }
public boolean matches(Method method) { return !getLookupKeysForMethod(method).isEmpty(); } });
/** * Helper method that registers the methods of the given class. This method iterates over the methods of the class, * and calls {@link #getLookupKeyForMethod(Method)} for each. If this returns a string, the method is registered * using {@link #registerEndpoint(Object, MethodEndpoint)}. * * @see #getLookupKeyForMethod(Method) * @see #getLookupKeysForMethod(Method) */ protected void registerMethods(String beanName) { Assert.hasText(beanName, "'beanName' must not be empty"); Class<?> endpointType = getApplicationContext().getType(beanName); endpointType = ClassUtils.getUserClass(endpointType); Set<Method> methods = findEndpointMethods(endpointType, new ReflectionUtils.MethodFilter() { public boolean matches(Method method) { return !getLookupKeysForMethod(method).isEmpty(); } }); for (Method method : methods) { List<T> keys = getLookupKeysForMethod(method); for (T key : keys) { registerEndpoint(key, new MethodEndpoint(beanName, getApplicationContext(), method)); } } }
/** * Lookup an endpoint for the given message. The extraction of the endpoint key is delegated to the concrete * subclass. * * @return the looked up endpoint, or {@code null} * @see #getLookupKeyForMessage(MessageContext) */ @Override protected Object getEndpointInternal(MessageContext messageContext) throws Exception { T key = getLookupKeyForMessage(messageContext); if (key == null) { return null; } if (logger.isDebugEnabled()) { logger.debug("Looking up endpoint for [" + key + "]"); } return lookupEndpoint(key); }
public void doWith(Method method) throws IllegalArgumentException, IllegalAccessException { List<T> keys = getLookupKeysForMethod(method); for (T key : keys) { registerEndpoint(key, new MethodEndpoint(endpoint, method)); } } });
@Override protected void initApplicationContext() throws BeansException { super.initApplicationContext(); if (logger.isDebugEnabled()) { logger.debug("Looking for endpoints in application context: " + getApplicationContext()); } String[] beanNames = (this.detectEndpointsInAncestorContexts ? BeanFactoryUtils.beanNamesForTypeIncludingAncestors(getApplicationContext(), Object.class) : getApplicationContext().getBeanNamesForType(Object.class)); for (String beanName : beanNames) { Class<?> endpointClass = getApplicationContext().getType(beanName); if (endpointClass != null && AnnotationUtils.findAnnotation(endpointClass, getEndpointAnnotationType()) != null) { registerMethods(beanName); } } }
/** * Helper method that registers the methods of the given bean. This method iterates over the methods of the bean, * and calls {@link #getLookupKeyForMethod(Method)} for each. If this returns a string, the method is registered * using {@link #registerEndpoint(Object, MethodEndpoint)}. * * @see #getLookupKeyForMethod(Method) */ protected void registerMethods(final Object endpoint) { Assert.notNull(endpoint, "'endpoint' must not be null"); Class<?> endpointClass = getEndpointClass(endpoint); ReflectionUtils.doWithMethods(endpointClass, new ReflectionUtils.MethodCallback() { public void doWith(Method method) throws IllegalArgumentException, IllegalAccessException { List<T> keys = getLookupKeysForMethod(method); for (T key : keys) { registerEndpoint(key, new MethodEndpoint(endpoint, method)); } } }); }