Files
FalsePatternLib/src/main/java/com/falsepattern/lib/dependencies/Library.java
T

145 lines
4.7 KiB
Java
Raw Normal View History

/*
2023-07-16 12:36:11 +02:00
* Copyright (C) 2022-2023 FalsePattern
* All Rights Reserved
*
2023-07-16 12:36:11 +02:00
* The above copyright notice and this permission notice
* shall be included in all copies or substantial portions of the Software.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
2022-08-06 14:18:18 +02:00
package com.falsepattern.lib.dependencies;
import com.falsepattern.lib.StableAPI;
import lombok.NonNull;
@StableAPI(since = "0.10.0")
public class Library {
@StableAPI.Expose
2022-08-17 20:10:51 +02:00
@NonNull
public final String loadingModId;
2022-08-06 14:18:18 +02:00
@StableAPI.Expose
2022-08-17 20:10:51 +02:00
@NonNull
public final String groupId;
2022-08-06 14:18:18 +02:00
@StableAPI.Expose
2022-08-17 20:10:51 +02:00
@NonNull
public final String artifactId;
2022-08-06 14:18:18 +02:00
@StableAPI.Expose
2022-08-17 20:10:51 +02:00
@NonNull
public final Version minVersion;
2022-08-06 14:18:18 +02:00
@StableAPI.Expose
public final Version maxVersion;
@StableAPI.Expose
2022-08-17 20:10:51 +02:00
@NonNull
public final Version preferredVersion;
2022-08-06 14:18:18 +02:00
@StableAPI.Expose
public final String regularSuffix;
@StableAPI.Expose
public final String devSuffix;
@StableAPI.Expose
public Library(@NonNull String loadingModId, @NonNull String groupId, @NonNull String artifactId, @NonNull Version minVersion, Version maxVersion, @NonNull Version preferredVersion, String regularSuffix, String devSuffix) {
this.loadingModId = loadingModId;
this.groupId = groupId;
this.artifactId = artifactId;
this.minVersion = minVersion;
this.maxVersion = maxVersion;
this.preferredVersion = preferredVersion;
this.regularSuffix = regularSuffix;
this.devSuffix = devSuffix;
}
@StableAPI.Expose
public static LibraryBuilder builder() {
return new LibraryBuilder();
}
@StableAPI(since = "0.10.0")
public static class LibraryBuilder {
private String loadingModId;
private String groupId;
private String artifactId;
private Version minVersion;
private Version maxVersion;
private Version preferredVersion;
private String regularSuffix;
private String devSuffix;
@StableAPI.Internal
LibraryBuilder() {
}
@StableAPI.Expose
public LibraryBuilder loadingModId(@NonNull String loadingModId) {
this.loadingModId = loadingModId;
return this;
}
@StableAPI.Expose
public LibraryBuilder groupId(@NonNull String groupId) {
this.groupId = groupId;
return this;
}
@StableAPI.Expose
public LibraryBuilder artifactId(@NonNull String artifactId) {
this.artifactId = artifactId;
return this;
}
@StableAPI.Expose
public LibraryBuilder minVersion(@NonNull Version minVersion) {
this.minVersion = minVersion;
return this;
}
@StableAPI.Expose
public LibraryBuilder maxVersion(Version maxVersion) {
this.maxVersion = maxVersion;
return this;
}
@StableAPI.Expose
public LibraryBuilder preferredVersion(@NonNull Version preferredVersion) {
this.preferredVersion = preferredVersion;
return this;
}
@StableAPI.Expose
public LibraryBuilder regularSuffix(String regularSuffix) {
this.regularSuffix = regularSuffix;
return this;
}
@StableAPI.Expose
public LibraryBuilder devSuffix(String devSuffix) {
this.devSuffix = devSuffix;
return this;
}
@StableAPI.Expose
public Library build() {
return new Library(loadingModId, groupId, artifactId, minVersion, maxVersion, preferredVersion,
regularSuffix, devSuffix);
}
@Override
public String toString() {
return "Library.LibraryBuilder(loadingModId=" + this.loadingModId + ", groupId=" + this.groupId +
", artifactId=" + this.artifactId + ", minVersion=" + this.minVersion + ", maxVersion=" +
this.maxVersion + ", preferredVersion=" + this.preferredVersion + ", regularSuffix=" +
this.regularSuffix + ", devSuffix=" + this.devSuffix + ")";
}
}
}