All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.metaeffekt.artifact.resolver.generic.FileLocation Maven / Gradle / Ivy

The newest version!
/*
 * Copyright 2021-2024 the original author or authors.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.metaeffekt.artifact.resolver.generic;

import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import org.apache.commons.lang3.StringUtils;

@ToString
public class FileLocation {

    @Getter
    @Setter
    private String ecosystem;

    /**
     * The filename without any path details.
     */
    @Getter
    @Setter
    private String filename;

    /**
     * The dispatchName is used to create the folder structure for grouping purposes. Ideally, the information does
     * not include any version information, such that versions are organized with the folder.
     */
    @Getter
    @Setter
    private String dispatchName;

    /**
     * The resource qualifier provides unambiguous addressing of the resource. E.g. groupid-artifactId-version.
     * 
* This should not be a path, but fit in a filename. */ @Getter @Setter private String resourceQualifier; public boolean isValid() { boolean valid = StringUtils.isNotBlank(ecosystem); valid |= StringUtils.isNotEmpty(filename); valid |= StringUtils.isNotEmpty(dispatchName); valid |= StringUtils.isNotEmpty(resourceQualifier); valid |= validateNoPath(ecosystem); valid |= validateNoPath(filename); valid |= validateNoPath(dispatchName); valid |= validateNoPath(resourceQualifier); return valid; } private boolean validateNoPath(String s) { return !s.contains("/") && !s.contains("\\"); } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy