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   * @author Benjamin Bentmann
28   */
29  public interface ClassRealmRequest {
30  
31      /**
32       * The type of a class realm.
33       */
34      enum RealmType {
35          /**
36           * The class realm for the public API of the Maven core.
37           */
38          Core,
39  
40          /**
41           * A class realm for a project to aggregates its build extensions.
42           */
43          Project,
44  
45          /**
46           * A class realm for a build extension.
47           */
48          Extension,
49  
50          /**
51           * A class realm for a plugin.
52           */
53          Plugin,
54      }
55  
56      /**
57       * Gets the type of the class realm.
58       *
59       * @return The type of the class realm, never {@code null}.
60       */
61      RealmType getType();
62  
63      /**
64       * Gets the parent class realm (if any).
65       *
66       * @return The parent class realm or {@code null} if using the default parent.
67       */
68      ClassLoader getParent();
69  
70      /**
71       * @deprecated Use {@link #getParentImports()} instead.
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  }