@@ -0,0 +1,2798 @@
+/*******************************************************************************%0A * This file is part of OpenNMS(R).%0A * %0A * Copyright (C) 2017 The OpenNMS Group, Inc.%0A * OpenNMS(R) is Copyright (C) 1999-2017 The OpenNMS Group, Inc.%0A * %0A * OpenNMS(R) is a registered trademark of The OpenNMS Group, Inc.%0A * %0A * OpenNMS(R) is free software: you can redistribute it and/or modify%0A * it under the terms of the GNU Affero General Public License as published%0A * by the Free Software Foundation, either version 3 of the License,%0A * or (at your option) any later version.%0A * %0A * OpenNMS(R) is distributed in the hope that it will be useful,%0A * but WITHOUT ANY WARRANTY; without even the implied warranty of%0A * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the%0A * GNU Affero General Public License for more details.%0A * %0A * You should have received a copy of the GNU Affero General Public License%0A * along with OpenNMS(R).  If not, see:%0A *     http://www.gnu.org/licenses/%0A * %0A * For more information contact:%0A *     OpenNMS(R) Licensing %3Clicense@opennms.org%3E%0A *     http://www.opennms.org/%0A *     http://www.opennms.com/%0A *******************************************************************************/%0A%0Apackage org.opennms.netmgt.config.utils;%0A%0Aimport java.util.Collection;%0A%0Apublic abstract class ConfigUtils %7B%0A    public static %3CT%3E T assertNotNull(final T value, final String name) throws IllegalArgumentException %7B%0A        if (value == null) %7B%0A            throw new IllegalArgumentException(%22'%22 + name + %22' cannot be null!%22);%0A        %7D%0A        return value;%0A    %7D%0A%0A    @SuppressWarnings(%22unchecked%22)%0A    public static %3CT%3E T assertNotEmpty(final T value, final String name) throws IllegalArgumentException %7B%0A        final T check = value instanceof String? (T)normalizeString((String) value) : value;%0A        assertNotNull(value, name);%0A        return check;%0A    %7D%0A    %0A    public static String normalizeString(final String s) %7B%0A        if (%22%22.equals(s)) return null;%0A        return s;%0A    %7D%0A%0A    public static String normalizeAndTrimString(final String value) %7B%0A        if (value == null) return null;%0A        return normalizeString(value).trim();%0A    %7D%0A%0A    public static %3CT extends Number%3E T assertMinimumInclusive(final T value, final long minimum, final String name) %7B%0A        if (value != null && value.longValue() %3C minimum) %7B%0A            throw new IllegalArgumentException(%22'%22 + name + %22' must be at least %22 + minimum);%0A        %7D%0A        return value;%0A    %7D%0A%0A    public static %3CT extends Collection%3C?%3E%3E T assertMinimumSize(final T value, final long minimum, final String name) %7B%0A        if (value != null && value.size() %3C minimum) %7B%0A            throw new IllegalArgumentException(%22'%22 + name + %22' must contain at least %22 + minimum + %22 entry!%22);%0A        %7D%0A        return value;%0A    %7D%0A%7D%0A

add a tool for easier assertion of setters on JAXB classes