30 lines
1.1 KiB
Java
30 lines
1.1 KiB
Java
package p.packer.declarations;
|
|
|
|
import java.util.List;
|
|
import java.util.Map;
|
|
import java.util.Objects;
|
|
|
|
public record PackerAssetDeclaration(
|
|
int schemaVersion,
|
|
String name,
|
|
String type,
|
|
Map<String, List<String>> inputsByRole,
|
|
String outputFormat,
|
|
String outputCodec,
|
|
boolean preloadEnabled) {
|
|
|
|
public PackerAssetDeclaration {
|
|
if (schemaVersion <= 0) {
|
|
throw new IllegalArgumentException("schemaVersion must be positive");
|
|
}
|
|
name = Objects.requireNonNull(name, "name").trim();
|
|
type = Objects.requireNonNull(type, "type").trim();
|
|
inputsByRole = Map.copyOf(Objects.requireNonNull(inputsByRole, "inputsByRole"));
|
|
outputFormat = Objects.requireNonNull(outputFormat, "outputFormat").trim();
|
|
outputCodec = Objects.requireNonNull(outputCodec, "outputCodec").trim();
|
|
if (name.isBlank() || type.isBlank() || outputFormat.isBlank() || outputCodec.isBlank()) {
|
|
throw new IllegalArgumentException("declaration fields must not be blank");
|
|
}
|
|
}
|
|
}
|