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

com.github.frontear.efkolia.impl.info.Metadata Maven / Gradle / Ivy

There is a newer version: 0.2.8
Show newest version
package com.github.frontear.efkolia.impl.info;

import com.github.frontear.efkolia.api.info.IMetadata;
import com.github.frontear.internal.*;
import lombok.*;

public final class Metadata implements IMetadata {
    private final String name, version, developers;

    public Metadata(@NonNull final String name, @NonNull final String version,
        @NonNull final String author, @Nullable final String... contributors) {
        this.name = name;
        this.version = version;

        if (contributors == null) {
            this.developers = author;
        }
        else {
            val authors = new String[contributors.length + 1]; // + 1 for the 'author'
            authors[0] = author;
            System.arraycopy(contributors, 0, authors, 1, contributors.length);

            val joined = String.join(", ", authors);
            val index = joined.lastIndexOf(", ");
            this.developers = index != -1 ? joined.substring(0, index) + ", and " + joined
                .substring(index + ", ".length()) : joined;
        }
    }

    @NotNull
    @Override
    public String getName() {
        return name;
    }

    @NotNull
    @Override
    public String getVersion() {
        return version;
    }

    @NotNull
    @Override
    public String getDevelopers() {
        return developers;
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy