|
| 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.cli.internal.extension.model; |
| 20 | + |
| 21 | +/** |
| 22 | + * Describes a build extension to utilise. |
| 23 | + * |
| 24 | + * @deprecated Use {@link org.apache.maven.api.cli.extensions.CoreExtension} instead |
| 25 | + */ |
| 26 | +@Deprecated |
| 27 | +@SuppressWarnings("all") |
| 28 | +public class CoreExtension implements java.io.Serializable { |
| 29 | + |
| 30 | + // --------------------------/ |
| 31 | + // - Class/Member Variables -/ |
| 32 | + // --------------------------/ |
| 33 | + |
| 34 | + /** |
| 35 | + * The group ID of the extension's artifact. |
| 36 | + */ |
| 37 | + private String groupId; |
| 38 | + |
| 39 | + /** |
| 40 | + * The artifact ID of the extension. |
| 41 | + */ |
| 42 | + private String artifactId; |
| 43 | + |
| 44 | + /** |
| 45 | + * The version of the extension. |
| 46 | + */ |
| 47 | + private String version; |
| 48 | + |
| 49 | + /** |
| 50 | + * The class loading strategy: 'self-first' (the default), |
| 51 | + * 'parent-first' (loads classes from the parent, then from the |
| 52 | + * extension) or 'plugin' (follows the rules from extensions |
| 53 | + * defined as plugins). |
| 54 | + */ |
| 55 | + private String classLoadingStrategy = "self-first"; |
| 56 | + |
| 57 | + // -----------/ |
| 58 | + // - Methods -/ |
| 59 | + // -----------/ |
| 60 | + |
| 61 | + /** |
| 62 | + * Get the artifact ID of the extension. |
| 63 | + * |
| 64 | + * @return String |
| 65 | + */ |
| 66 | + public String getArtifactId() { |
| 67 | + return this.artifactId; |
| 68 | + } // -- String getArtifactId() |
| 69 | + |
| 70 | + /** |
| 71 | + * Get the class loading strategy: 'self-first' (the default), |
| 72 | + * 'parent-first' (loads classes from the parent, then from the |
| 73 | + * extension) or 'plugin' (follows the rules from extensions |
| 74 | + * defined as plugins). |
| 75 | + * |
| 76 | + * @return String |
| 77 | + */ |
| 78 | + public String getClassLoadingStrategy() { |
| 79 | + return this.classLoadingStrategy; |
| 80 | + } // -- String getClassLoadingStrategy() |
| 81 | + |
| 82 | + /** |
| 83 | + * Get the group ID of the extension's artifact. |
| 84 | + * |
| 85 | + * @return String |
| 86 | + */ |
| 87 | + public String getGroupId() { |
| 88 | + return this.groupId; |
| 89 | + } // -- String getGroupId() |
| 90 | + |
| 91 | + /** |
| 92 | + * Get the version of the extension. |
| 93 | + * |
| 94 | + * @return String |
| 95 | + */ |
| 96 | + public String getVersion() { |
| 97 | + return this.version; |
| 98 | + } // -- String getVersion() |
| 99 | + |
| 100 | + /** |
| 101 | + * Set the artifact ID of the extension. |
| 102 | + * |
| 103 | + * @param artifactId a artifactId object. |
| 104 | + */ |
| 105 | + public void setArtifactId(String artifactId) { |
| 106 | + this.artifactId = artifactId; |
| 107 | + } // -- void setArtifactId( String ) |
| 108 | + |
| 109 | + /** |
| 110 | + * Set the class loading strategy: 'self-first' (the default), |
| 111 | + * 'parent-first' (loads classes from the parent, then from the |
| 112 | + * extension) or 'plugin' (follows the rules from extensions |
| 113 | + * defined as plugins). |
| 114 | + * |
| 115 | + * @param classLoadingStrategy a classLoadingStrategy object. |
| 116 | + */ |
| 117 | + public void setClassLoadingStrategy(String classLoadingStrategy) { |
| 118 | + this.classLoadingStrategy = classLoadingStrategy; |
| 119 | + } // -- void setClassLoadingStrategy( String ) |
| 120 | + |
| 121 | + /** |
| 122 | + * Set the group ID of the extension's artifact. |
| 123 | + * |
| 124 | + * @param groupId a groupId object. |
| 125 | + */ |
| 126 | + public void setGroupId(String groupId) { |
| 127 | + this.groupId = groupId; |
| 128 | + } // -- void setGroupId( String ) |
| 129 | + |
| 130 | + /** |
| 131 | + * Set the version of the extension. |
| 132 | + * |
| 133 | + * @param version a version object. |
| 134 | + */ |
| 135 | + public void setVersion(String version) { |
| 136 | + this.version = version; |
| 137 | + } // -- void setVersion( String ) |
| 138 | + |
| 139 | + /** |
| 140 | + * Gets the identifier of the extension. |
| 141 | + * |
| 142 | + * @return The extension id in the form {@code <groupId>:<artifactId>:<version>}, never {@code null}. |
| 143 | + */ |
| 144 | + public String getId() { |
| 145 | + StringBuilder id = new StringBuilder(128); |
| 146 | + |
| 147 | + id.append((getGroupId() == null) ? "[unknown-group-id]" : getGroupId()); |
| 148 | + id.append(":"); |
| 149 | + id.append((getArtifactId() == null) ? "[unknown-artifact-id]" : getArtifactId()); |
| 150 | + id.append(":"); |
| 151 | + id.append((getVersion() == null) ? "[unknown-version]" : getVersion()); |
| 152 | + |
| 153 | + return id.toString(); |
| 154 | + } |
| 155 | +} |
0 commit comments