@ -145,17 +145,17 @@ public abstract class EndpointDiscoverer<E extends ExposableEndpoint<O>, O exten
}
private void addExtensionBeans ( Collection < EndpointBean > endpointBeans ) {
Map < ? , EndpointBean > byType = endpointBeans . stream ( )
. collect ( Collectors . toMap ( ( bean ) - > bean . getType ( ) , ( bean ) - > bean ) ) ;
Map < String , EndpointBean > byId = endpointBeans . stream ( )
. collect ( Collectors . toMap ( EndpointBean : : getId , ( bean ) - > bean ) ) ;
String [ ] beanNames = BeanFactoryUtils . beanNamesForAnnotationIncludingAncestors (
this . applicationContext , EndpointExtension . class ) ;
for ( String beanName : beanNames ) {
ExtensionBean extensionBean = createExtensionBean ( beanName ) ;
EndpointBean endpointBean = by Type. get ( extensionBean . getEndpointType ( ) ) ;
EndpointBean endpointBean = by Id. get ( extensionBean . getEndpointId ( ) ) ;
Assert . state ( endpointBean ! = null ,
( ) - > ( "Invalid extension '" + extensionBean . getBeanName ( )
+ "': no endpoint found with type '"
+ extensionBean . getEndpoint Type( ) . getName ( ) + "'" ) ) ;
+ "': no endpoint found with id '"
+ extensionBean . getEndpoint Id ( ) + "'" ) ) ;
addExtensionBean ( endpointBean , extensionBean ) ;
}
}
@ -488,20 +488,24 @@ public abstract class EndpointDiscoverer<E extends ExposableEndpoint<O>, O exten
private final Object bean ;
private final Class< ? > endpointType ;
private final String endpointId ;
private final Class < ? > filter ;
ExtensionBean ( String beanName , Object bean ) {
this . bean = bean ;
this . beanName = beanName ;
AnnotationAttributes attributes = AnnotatedElementUtils
. getMergedAnnotationAttributes ( bean . getClass ( ) ,
EndpointExtension . class ) ;
this . beanName = beanName ;
this . bean = bean ;
this . endpointType = attributes . getClass ( "endpoint" ) ;
Class < ? > endpointType = attributes . getClass ( "endpoint" ) ;
AnnotationAttributes endpointAttributes = AnnotatedElementUtils
. findMergedAnnotationAttributes ( endpointType , Endpoint . class , true ,
true ) ;
Assert . state ( endpointAttributes ! = null , ( ) - > "Extension "
+ endpointType . getName ( ) + " does not specify an endpoint" ) ;
this . endpointId = endpointAttributes . getString ( "id" ) ;
this . filter = attributes . getClass ( "filter" ) ;
Assert . state ( ! this . endpointType . equals ( Void . class ) , ( ) - > "Extension "
+ this . endpointType . getName ( ) + " does not specify an endpoint" ) ;
}
public String getBeanName ( ) {
@ -512,8 +516,8 @@ public abstract class EndpointDiscoverer<E extends ExposableEndpoint<O>, O exten
return this . bean ;
}
public Class< ? > getEndpointType ( ) {
return this . endpoint Type ;
public String getEndpointId ( ) {
return this . endpoint Id ;
}
public Class < ? > getFilter ( ) {