Skip to content

Method: lambda$getNPXMessageSupplier$0(String)

1: /*
2: * JOPA
3: * Copyright (C) 2024 Czech Technical University in Prague
4: *
5: * This library is free software; you can redistribute it and/or
6: * modify it under the terms of the GNU Lesser General Public
7: * License as published by the Free Software Foundation; either
8: * version 3.0 of the License, or (at your option) any later version.
9: *
10: * This library is distributed in the hope that it will be useful,
11: * but WITHOUT ANY WARRANTY; without even the implied warranty of
12: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13: * Lesser General Public License for more details.
14: *
15: * You should have received a copy of the GNU Lesser General Public
16: * License along with this library.
17: */
18: package cz.cvut.kbss.ontodriver.util;
19:
20: import java.util.function.Supplier;
21:
22: // TODO Remove
23: public class ErrorUtils {
24:
25: /**
26: * Error message stating that an argument cannot be null. </p>
27: * <p>
28: * This message contains a placeholder {@code arg}, which should be replaced with the actual argument name.
29: */
30: private static final String ARGUMENT_NULL = "Argument '$arg$' cannot be null.";
31:
32: private static final String PLACEHOLDER = "$arg$";
33:
34: private ErrorUtils() {
35: throw new AssertionError();
36: }
37:
38: /**
39: * Provides a {@link NullPointerException} message supplier.
40: * <p>
41: * This supplier constructs messages which state than an argument with the specified name cannot be null.
42: *
43: * @param argName Argument name
44: * @return Error message supplier
45: */
46: public static Supplier<String> getNPXMessageSupplier(final String argName) {
47: return () -> ARGUMENT_NULL.replace(PLACEHOLDER, argName);
48: }
49: }