2 * ============LICENSE_START=======================================================
\r
4 * ================================================================================
\r
5 * Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved.
\r
6 * ================================================================================
\r
7 * Licensed under the Apache License, Version 2.0 (the "License");
\r
8 * you may not use this file except in compliance with the License.
\r
9 * You may obtain a copy of the License at
\r
11 * http://www.apache.org/licenses/LICENSE-2.0
\r
13 * Unless required by applicable law or agreed to in writing, software
\r
14 * distributed under the License is distributed on an "AS IS" BASIS,
\r
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
\r
16 * See the License for the specific language governing permissions and
\r
17 * limitations under the License.
\r
18 * ============LICENSE_END=========================================================
\r
21 package org.openecomp.mso.adapters.vfc.util;
\r
23 import org.openecomp.mso.adapters.vfc.constant.HttpCode;
\r
24 import org.openecomp.mso.adapters.vfc.exceptions.ApplicationException;
\r
25 import org.slf4j.Logger;
\r
26 import org.slf4j.LoggerFactory;
\r
28 public class ValidateUtil {
\r
33 private static final Logger LOGGER = LoggerFactory.getLogger(ValidateUtil.class);
\r
40 * @since ONAP Amsterdam Release 2017-9-6
\r
42 private ValidateUtil() {
\r
47 * Assert String parameter.<br/>
\r
49 * @param paramValue parameter data
\r
50 * @param name of parameter
\r
51 * @since ONAP Amsterdam Release 2017-9-6
\r
53 public static void assertStringNotNull(String paramValue, String paramName)
\r
54 throws ApplicationException {
\r
55 if (null != paramValue && !paramValue.isEmpty()) {
\r
59 LOGGER.error(paramName + ": Parameter is null or empty.");
\r
60 throw new ApplicationException(HttpCode.BAD_REQUEST, paramName + ": Invalid parameter.");
\r
64 * Assert object is null.<br/>
\r
66 * @param object data object
\r
67 * @since ONAP Amsterdam Release 2017-9-6
\r
69 public static void assertObjectNotNull(Object object) throws ApplicationException {
\r
70 if (null == object) {
\r
71 LOGGER.error("Object is null.");
\r
72 throw new ApplicationException(HttpCode.BAD_REQUEST, "Object is null.");
\r
82 * @since ONAP Amsterdam Release
\r
84 public static boolean isStrEmpty(String str) {
\r
85 return null == str || str.isEmpty();
\r