001/* 002 * Licensed to the Apache Software Foundation (ASF) under one 003 * or more contributor license agreements. See the NOTICE file 004 * distributed with this work for additional information 005 * regarding copyright ownership. The ASF licenses this file 006 * to you under the Apache License, Version 2.0 (the 007 * "License"); you may not use this file except in compliance 008 * with the License. You may obtain a copy of the License at 009 * 010 * http://www.apache.org/licenses/LICENSE-2.0 011 * 012 * Unless required by applicable law or agreed to in writing, 013 * software distributed under the License is distributed on an 014 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 015 * KIND, either express or implied. See the License for the 016 * specific language governing permissions and limitations 017 * under the License. 018 */ 019package org.eclipse.aether.internal.impl.synccontext.named; 020 021import org.eclipse.aether.artifact.Artifact; 022 023/** 024 * Artifact GAECV {@link NameMapper} extends {@link GAVNameMapper} and improves artifact name mapping selectivity by 025 * using all coordinates. 026 * 027 * @since 1.9.25 028 */ 029public class GAECVNameMapper extends GAVNameMapper { 030 public GAECVNameMapper( 031 boolean fileSystemFriendly, 032 String artifactPrefix, 033 String artifactSuffix, 034 String metadataPrefix, 035 String metadataSuffix, 036 String fieldSeparator) { 037 super(fileSystemFriendly, artifactPrefix, artifactSuffix, metadataPrefix, metadataSuffix, fieldSeparator); 038 } 039 040 @Override 041 protected String getArtifactName(Artifact artifact) { 042 if (artifact.getClassifier().isEmpty()) { 043 return artifactPrefix 044 + fieldToSegment(artifact.getGroupId()) 045 + fieldSeparator 046 + fieldToSegment(artifact.getArtifactId()) 047 + fieldSeparator 048 + fieldToSegment(artifact.getExtension()) 049 + fieldSeparator 050 + fieldToSegment(artifact.getBaseVersion()) 051 + artifactSuffix; 052 } else { 053 return artifactPrefix 054 + fieldToSegment(artifact.getGroupId()) 055 + fieldSeparator 056 + fieldToSegment(artifact.getArtifactId()) 057 + fieldSeparator 058 + fieldToSegment(artifact.getExtension()) 059 + fieldSeparator 060 + fieldToSegment(artifact.getClassifier()) 061 + fieldSeparator 062 + fieldToSegment(artifact.getBaseVersion()) 063 + artifactSuffix; 064 } 065 } 066}