spring-framework / org.springframework.core

Package org.springframework.core

Types

BridgeMethodResolver

abstract class BridgeMethodResolver

Helper for resolving synthetic bridge Methods to the Method being bridged.

Given a synthetic bridge Method returns the Method being bridged. A bridge method may be created by the compiler when extending a parameterized type whose methods have parameterized arguments. During runtime invocation the bridge Method may be invoked and/or used via reflection. When attempting to locate annotations on Method, it is wise to check for bridge Method as appropriate and find the bridged Method.

See The Java Language Specification for more details on the use of bridge methods.

CollectionFactory

abstract class CollectionFactory

Factory for collections that is aware of Java 5, Java 6, and Spring collection types.

Mainly for internal use within the framework.

DecoratingProxy

interface DecoratingProxy

Interface to be implemented by decorating proxies, in particular Spring AOP proxies but potentially also custom proxies with decorator semantics.

Note that this interface should just be implemented if the decorated class is not within the hierarchy of the proxy class to begin with. In particular, a "target-class" proxy such as a Spring AOP CGLIB proxy should not implement it since any lookup on the target class can simply be performed on the proxy class there anyway.

Defined in the core module in order to allow #org.springframework.core.annotation.AnnotationAwareOrderComparator (and potential other candidates without spring-aop dependencies) to use it for introspection purposes, in particular annotation lookups.

ExceptionDepthComparator

open class ExceptionDepthComparator : Comparator<Class<out Throwable>>

Comparator capable of sorting exceptions based on their depth from the thrown exception type.

GenericTypeResolver

abstract class GenericTypeResolver

Helper class for resolving generic types against type variables.

Mainly intended for usage within the framework, resolving method parameter types even when they are declared generically.

InfrastructureProxy

interface InfrastructureProxy

Interface to be implemented by transparent resource proxies that need to be considered as equal to the underlying resource, for example for consistent lookup key comparisons. Note that this interface does imply such special semantics and does not constitute a general-purpose mixin!

Such wrappers will automatically be unwrapped for key comparisons in org.springframework.transaction.support.TransactionSynchronizationManager.

Only fully transparent proxies, e.g. for redirection or service lookups, are supposed to implement this interface. Proxies that decorate the target object with new behavior, such as AOP proxies, do not qualify here!

KotlinDetector

abstract class KotlinDetector

A common delegate for detecting Kotlin's presence and for identifying Kotlin types.

KotlinReflectionParameterNameDiscoverer

open class KotlinReflectionParameterNameDiscoverer : ParameterNameDiscoverer

ParameterNameDiscoverer implementation which uses Kotlin's reflection facilities for introspecting parameter names. Compared to StandardReflectionParameterNameDiscoverer, it allows in addition to determine interface parameter names without requiring Java 8 -parameters compiler flag.

LocalVariableTableParameterNameDiscoverer

open class LocalVariableTableParameterNameDiscoverer : ParameterNameDiscoverer

Implementation of ParameterNameDiscoverer that uses the LocalVariableTable information in the method attributes to discover parameter names. Returns null if the class file was compiled without debug information.

Uses ObjectWeb's ASM library for analyzing class files. Each discoverer instance caches the ASM discovered information for each introspected Class, in a thread-safe manner. It is recommended to reuse ParameterNameDiscoverer instances as far as possible.

NamedInheritableThreadLocal

open class NamedInheritableThreadLocal<T : Any> : InheritableThreadLocal<T>

InheritableThreadLocal subclass that exposes a specified name as #toString() result (allowing for introspection).

NestedExceptionUtils

abstract class NestedExceptionUtils

Helper class for implementing exception classes which are capable of holding nested exceptions. Necessary because we can't share a base class among different exception types.

Mainly for use within the framework.

PrioritizedParameterNameDiscoverer

open class PrioritizedParameterNameDiscoverer : ParameterNameDiscoverer

ParameterNameDiscoverer implementation that tries several discoverer delegates in succession. Those added first in the addDiscoverer method have highest priority. If one returns null, the next will be tried.

The default behavior is to return null if no discoverer matches.

ReactiveAdapterRegistry

open class ReactiveAdapterRegistry

A registry of adapters to adapt a Reactive Streams Publisher to/from various async/reactive types such as CompletableFuture, RxJava Observable, and others.

By default, depending on classpath availability, adapters are registered for Reactor, RxJava 1, RxJava 2 types, CompletableFuture, and Java 9+ Flow.Publisher.

ResolvableTypeProvider

interface ResolvableTypeProvider

Any object can implement this interface to provide its actual ResolvableType.

Such information is very useful when figuring out if the instance matches a generic signature as Java does not convey the signature at runtime.

Users of this interface should be careful in complex hierarchy scenarios, especially when the generic type signature of the class changes in sub-classes. It is always possible to return null to fallback on a default behavior.

SmartClassLoader

interface SmartClassLoader

Interface to be implemented by a reloading-aware ClassLoader (e.g. a Groovy-based ClassLoader). Detected for example by Spring's CGLIB proxy factory for making a caching decision.

If a ClassLoader does not implement this interface, then all of the classes obtained from it should be considered as not reloadable (i.e. cacheable).

SpringVersion

open class SpringVersion

Class that exposes the Spring version. Fetches the "Implementation-Version" manifest attribute from the jar file.

Note that some ClassLoaders do not expose the package metadata, hence this class might not be able to determine the Spring version in all environments. Consider using a reflection-based check instead: For example, checking for the presence of a specific Spring 2.0 method that you intend to call.

StandardReflectionParameterNameDiscoverer

open class StandardReflectionParameterNameDiscoverer : ParameterNameDiscoverer

ParameterNameDiscoverer implementation which uses JDK 8's reflection facilities for introspecting parameter names (based on the "-parameters" compiler flag).

Exceptions

NestedCheckedException

abstract class NestedCheckedException : Exception

Handy class for wrapping checked Exceptions with a root cause.

This class is abstract to force the programmer to extend the class. getMessage will include nested exception information; printStackTrace and other like methods will delegate to the wrapped exception, if any.

The similarity between this class and the NestedRuntimeException class is unavoidable, as Java forces these two classes to have different superclasses (ah, the inflexibility of concrete inheritance!).

NestedIOException

open class NestedIOException : IOException

Subclass of IOException that properly handles a root cause, exposing the root cause just like NestedChecked/RuntimeException does.

Proper root cause handling has not been added to standard IOException before Java 6, which is why we need to do it ourselves for Java 5 compatibility purposes.

The similarity between this class and the NestedChecked/RuntimeException class is unavoidable, as this class needs to derive from IOException.