|
27 | 27 | import static io.microsphere.util.ClassLoaderUtils.findURLClassLoader; |
28 | 28 |
|
29 | 29 | /** |
30 | | - * The handle interface for URL Class-Path |
| 30 | + * A strategy interface for handling URL Class-Path entries in a {@link ClassLoader}. |
| 31 | + * Implementations of this interface can provide custom logic for interacting with |
| 32 | + * URLs related to class loading, such as retrieving or removing URLs from a class loader. |
| 33 | + * |
| 34 | + * <p> |
| 35 | + * This interface extends {@link Prioritized}, allowing implementations to define their |
| 36 | + * priority order. The default implementation of {@link #getPriority()} returns |
| 37 | + * {@link Prioritized#MIN_PRIORITY}, making it the lowest priority unless overridden. |
| 38 | + * </p> |
| 39 | + * |
| 40 | + * <h2>Example Implementation</h2> |
| 41 | + * <pre>{@code |
| 42 | + * public class ClassicURLClassPathHandle implements URLClassPathHandle { |
| 43 | + * |
| 44 | + * private final int priority; |
| 45 | + * |
| 46 | + * public ClassicURLClassPathHandle(int priority) { |
| 47 | + * this.priority = priority; |
| 48 | + * } |
| 49 | + * |
| 50 | + * public boolean supports() { |
| 51 | + * return true; // Always support classic handling |
| 52 | + * } |
| 53 | + * |
| 54 | + * public boolean removeURL(ClassLoader classLoader, URL url) { |
| 55 | + * // Custom logic to remove a URL from the class loader |
| 56 | + * return false; // Placeholder implementation |
| 57 | + * } |
| 58 | + * |
| 59 | + * public int getPriority() { |
| 60 | + * return priority; // Custom priority |
| 61 | + * } |
| 62 | + * } |
| 63 | + * }</pre> |
31 | 64 | * |
32 | 65 | * @author <a href="mailto:mercyblitz@gmail.com">Mercy<a/> |
33 | 66 | * @see ClassicURLClassPathHandle |
34 | 67 | * @see ModernURLClassPathHandle |
| 68 | + * @see Prioritized |
35 | 69 | * @since 1.0.0 |
36 | 70 | */ |
37 | 71 | public interface URLClassPathHandle extends Prioritized { |
|
0 commit comments