Skip to content

io microsphere classloading URLClassPathHandle

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

URLClassPathHandle

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

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

Overview

A strategy interface for handling URL Class-Path entries in a ClassLoader. Implementations of this interface can provide custom logic for interacting with URLs related to class loading, such as retrieving or removing URLs from a class loader.

This interface extends Prioritized, allowing implementations to define their priority order. The default implementation of #getPriority() returns Prioritized#MIN_PRIORITY, making it the lowest priority unless overridden.

Example Usage

`public class ClassicURLClassPathHandle implements URLClassPathHandle {

    private final int priority;

    public ClassicURLClassPathHandle(int priority) {
        this.priority = priority;
    `

    public boolean supports() {
        return true; // Always support classic handling
    }

    public boolean removeURL(ClassLoader classLoader, URL url) {
        // Custom logic to remove a URL from the class loader
        return false; // Placeholder implementation
    }

    public int getPriority() {
        return priority; // Custom priority
    }
}
}

Declaration

public interface URLClassPathHandle extends 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 implements URLClassPathHandle {

    private final int priority;

    public ClassicURLClassPathHandle(int priority) {
        this.priority = priority;
    }

    public boolean supports() {
        return true; // Always support classic handling
    }

    public boolean removeURL(ClassLoader classLoader, URL url) {
        // Custom logic to remove a URL from the class loader
        return false; // Placeholder implementation
    }

    public int getPriority() {
        return priority; // Custom priority
    }
}

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.URLClassPathHandle;

See Also

  • ClassicURLClassPathHandle
  • ModernURLClassPathHandle
  • 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