Skip to content

io microsphere classloading AbstractURLClassPathHandle

github-actions[bot] edited this page Mar 21, 2026 · 1 revision

AbstractURLClassPathHandle

Type: Class | Module: microsphere-java-core | Package: io.microsphere.classloading | Since: 1.0.0

Source: microsphere-java-core/src/main/java/io/microsphere/classloading/AbstractURLClassPathHandle.java

Overview

Abstract implementation of URLClassPathHandle that provides a base for handling URL Class-Path entries.

This class offers reflective access to internal structures like the ucp, urls, and loaders fields used by the JVM's class loading mechanism. It is primarily designed for advanced use cases where fine-grained control over class loader URLs is required, such as dynamic removal or modification of URLs from a class loader.

Key Features:

  • Supports reflective manipulation of internal JVM class loading structures.
  • Provides abstraction over different versions of JVM internals (e.g., classic vs modern JDK).
  • Implements the Prioritized interface to allow prioritization among multiple handlers.

Example Usage

`public class ClassicURLClassPathHandle extends AbstractURLClassPathHandle {

    public ClassicURLClassPathHandle() {
        // Default constructor
    `

    protected String getURLClassPathClassName() {
        return "sun.misc.URLClassPath";
    }

    protected String getUrlsFieldName() {
        return "urls"; // Classic field name
    }
}
}

Declaration

public abstract class AbstractURLClassPathHandle implements URLClassPathHandle, Prioritized

Author: Mercy

Version Information

  • Introduced in: 1.0.0
  • Current Project Version: 0.1.10-SNAPSHOT

Version Compatibility

This component is tested and compatible with the following Java versions:

Java Version Status
Java 8 ✅ Compatible
Java 11 ✅ Compatible
Java 17 ✅ Compatible
Java 21 ✅ Compatible
Java 25 ✅ Compatible

Examples

public class ClassicURLClassPathHandle extends AbstractURLClassPathHandle {

    public ClassicURLClassPathHandle() {
        // Default constructor
    }

    protected String getURLClassPathClassName() {
        return "sun.misc.URLClassPath";
    }

    protected String getUrlsFieldName() {
        return "urls"; // Classic field name
    }
}

Usage

Maven Dependency

Add the following dependency to your pom.xml:

<dependency>
    <groupId>io.github.microsphere-projects</groupId>
    <artifactId>microsphere-java-core</artifactId>
    <version>${microsphere-java.version}</version>
</dependency>

Tip: Use the BOM (microsphere-java-dependencies) for consistent version management. See the Getting Started guide.

Import

import io.microsphere.classloading.AbstractURLClassPathHandle;

API Reference

Public Methods

Method Description
supports
getURLs
removeURL
setPriority
getPriority

See Also

  • ClassicURLClassPathHandle
  • ModernURLClassPathHandle
  • URLClassPathHandle
  • Prioritized

This documentation was auto-generated from the source code of microsphere-java.

Home

java-annotations

java-core

jdk-tools

lang-model

annotation-processor

java-test

Clone this wiki locally