View Javadoc
1   /*
2    * Licensed to the Apache Software Foundation (ASF) under one
3    * or more contributor license agreements.  See the NOTICE file
4    * distributed with this work for additional information
5    * regarding copyright ownership.  The ASF licenses this file
6    * to you under the Apache License, Version 2.0 (the
7    * "License"); you may not use this file except in compliance
8    * with the License.  You may obtain a copy of the License at
9    *
10   *   http://www.apache.org/licenses/LICENSE-2.0
11   *
12   * Unless required by applicable law or agreed to in writing,
13   * software distributed under the License is distributed on an
14   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15   * KIND, either express or implied.  See the License for the
16   * specific language governing permissions and limitations
17   * under the License.
18   */
19  package org.apache.maven.classrealm;
20  
21  import java.util.List;
22  import java.util.Map;
23  
24  /**
25   * Describes the requirements for a new class realm.
26   *
27   */
28  public interface ClassRealmRequest {
29  
30      /**
31       * The type of a class realm.
32       */
33      enum RealmType {
34          /**
35           * The class realm for the public API of the Maven core.
36           */
37          Core,
38  
39          /**
40           * A class realm for a project to aggregates its build extensions.
41           */
42          Project,
43  
44          /**
45           * A class realm for a build extension.
46           */
47          Extension,
48  
49          /**
50           * A class realm for a plugin.
51           */
52          Plugin,
53      }
54  
55      /**
56       * Gets the type of the class realm.
57       *
58       * @return The type of the class realm, never {@code null}.
59       */
60      RealmType getType();
61  
62      /**
63       * Gets the parent class realm (if any).
64       *
65       * @return The parent class realm or {@code null} if using the default parent.
66       */
67      ClassLoader getParent();
68  
69      /**
70       * @deprecated Use {@link #getParentImports()} instead.
71       * @return imports
72       */
73      @Deprecated
74      List<String> getImports();
75  
76      /**
77       * Gets the packages/types to import from the parent realm.
78       *
79       * @return The modifiable list of packages/types to import from the parent realm, never {@code null}.
80       */
81      List<String> getParentImports();
82  
83      /**
84       * Gets the packages/types to import from foreign realms.
85       *
86       * @return The modifiable map of packages/types to import from foreign realms, never {@code null}.
87       */
88      Map<String, ClassLoader> getForeignImports();
89  
90      /**
91       * Gets the constituents for the class realm.
92       *
93       * @return The modifiable list of constituents for the class realm, never {@code null}.
94       */
95      List<ClassRealmConstituent> getConstituents();
96  }