Package iu.type

Class BackwardsCompatibility

java.lang.Object
iu.type.BackwardsCompatibility

final class BackwardsCompatibility extends Object
Provides access to context-compatible versions of context-sensitive classes.

A context-sensitive class is public and intended to be loaded by direct reference from its component rather than shared by parent or module delegation. For example, Resource.

Context-compatible refers to a class that has the same name, or a compatible name (i.e., javax.* vs. jakarta.*), as a context-sensitive class, and is guaranteed to be visible to the current thread's Thread.getContextClassLoader().

  • Method Details

    • getCompatibleClass

      static Class<?> getCompatibleClass(Class<?> contextSensitive) throws ClassNotFoundException
      Gets a context-compatible equivalent of a context-sensitive class.
      Parameters:
      contextSensitive - context-sensitive class
      Returns:
      context-compatible equivalent
      Throws:
      ClassNotFoundException - If a remote equivalent is not available for the local class.
    • getCompatibleClass

      static Class<?> getCompatibleClass(Class<?> contextSensitive, ClassLoader contextLoader) throws ClassNotFoundException
      Gets a context-compatible equivalent of a context-sensitive class.
      Parameters:
      contextSensitive - context-sensitive class
      contextLoader - ClassLoader that defines the context
      Returns:
      context-compatible equivalent
      Throws:
      ClassNotFoundException - If a remote equivalent is not available for the local class.