Polishing
This commit is contained in:
@@ -104,31 +104,6 @@ public class ReactiveAdapterRegistry {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return a shared default {@code ReactiveAdapterRegistry} instance, lazily
|
||||
* building it once needed.
|
||||
* <p><b>NOTE:</b> We highly recommend passing a long-lived, pre-configured
|
||||
* {@code ReactiveAdapterRegistry} instance for customization purposes.
|
||||
* This accessor is only meant as a fallback for code paths that want to
|
||||
* fall back on a default instance if one isn't provided.
|
||||
* @return the shared {@code ReactiveAdapterRegistry} instance (never {@code null})
|
||||
* @since 5.0.2
|
||||
*/
|
||||
public static ReactiveAdapterRegistry getSharedInstance() {
|
||||
ReactiveAdapterRegistry ar = sharedInstance;
|
||||
if (ar == null) {
|
||||
synchronized (ReactiveAdapterRegistry.class) {
|
||||
ar = sharedInstance;
|
||||
if (ar == null) {
|
||||
ar = new ReactiveAdapterRegistry();
|
||||
sharedInstance = ar;
|
||||
}
|
||||
}
|
||||
}
|
||||
return ar;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Whether the registry has any adapters which would be the case if any of
|
||||
* Reactor, RxJava 2, or RxJava 1 (+ RxJava Reactive Streams bridge) are
|
||||
@@ -138,7 +113,6 @@ public class ReactiveAdapterRegistry {
|
||||
return !this.adapters.isEmpty();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Register a reactive type along with functions to adapt to and from a
|
||||
* Reactive Streams {@link Publisher}. The functions can assume their
|
||||
@@ -190,6 +164,31 @@ public class ReactiveAdapterRegistry {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return a shared default {@code ReactiveAdapterRegistry} instance, lazily
|
||||
* building it once needed.
|
||||
* <p><b>NOTE:</b> We highly recommend passing a long-lived, pre-configured
|
||||
* {@code ReactiveAdapterRegistry} instance for customization purposes.
|
||||
* This accessor is only meant as a fallback for code paths that want to
|
||||
* fall back on a default instance if one isn't provided.
|
||||
* @return the shared {@code ReactiveAdapterRegistry} instance (never {@code null})
|
||||
* @since 5.0.2
|
||||
*/
|
||||
public static ReactiveAdapterRegistry getSharedInstance() {
|
||||
ReactiveAdapterRegistry ar = sharedInstance;
|
||||
if (ar == null) {
|
||||
synchronized (ReactiveAdapterRegistry.class) {
|
||||
ar = sharedInstance;
|
||||
if (ar == null) {
|
||||
ar = new ReactiveAdapterRegistry();
|
||||
sharedInstance = ar;
|
||||
}
|
||||
}
|
||||
}
|
||||
return ar;
|
||||
}
|
||||
|
||||
|
||||
private static class ReactorRegistrar {
|
||||
|
||||
void registerAdapters(ReactiveAdapterRegistry registry) {
|
||||
|
||||
@@ -44,6 +44,15 @@ public class DefaultConversionService extends GenericConversionService {
|
||||
private static volatile DefaultConversionService sharedInstance;
|
||||
|
||||
|
||||
/**
|
||||
* Create a new {@code DefaultConversionService} with the set of
|
||||
* {@linkplain DefaultConversionService#addDefaultConverters(ConverterRegistry) default converters}.
|
||||
*/
|
||||
public DefaultConversionService() {
|
||||
addDefaultConverters(this);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return a shared default {@code ConversionService} instance,
|
||||
* lazily building it once needed.
|
||||
@@ -69,18 +78,6 @@ public class DefaultConversionService extends GenericConversionService {
|
||||
return cs;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Create a new {@code DefaultConversionService} with the set of
|
||||
* {@linkplain DefaultConversionService#addDefaultConverters(ConverterRegistry) default converters}.
|
||||
*/
|
||||
public DefaultConversionService() {
|
||||
addDefaultConverters(this);
|
||||
}
|
||||
|
||||
|
||||
// static utility methods
|
||||
|
||||
/**
|
||||
* Add converters appropriate for most environments.
|
||||
* @param converterRegistry the registry of converters to add to (must also be castable to ConversionService,
|
||||
@@ -134,9 +131,6 @@ public class DefaultConversionService extends GenericConversionService {
|
||||
converterRegistry.addConverter(new StreamConverter(conversionService));
|
||||
}
|
||||
|
||||
|
||||
// internal helpers
|
||||
|
||||
private static void addScalarConverters(ConverterRegistry converterRegistry) {
|
||||
converterRegistry.addConverterFactory(new NumberToNumberConverterFactory());
|
||||
|
||||
|
||||
Reference in New Issue
Block a user