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