2 * Copyright (c) 2018 Orange
4 * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
5 * in compliance with the License. You may obtain a copy of the License at
7 * http://www.apache.org/licenses/LICENSE-2.0
9 * Unless required by applicable law or agreed to in writing, software distributed under the License
10 * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
11 * or implied. See the License for the specific language governing permissions and limitations under
14 package org.onap.nbi.commons;
16 import org.apache.commons.beanutils.PropertyUtilsBean;
17 import org.slf4j.Logger;
18 import org.slf4j.LoggerFactory;
23 public class BeanUtils {
25 private static final Logger LOGGER = LoggerFactory.getLogger(BeanUtils.class);
27 private static final PropertyUtilsBean PUB = new PropertyUtilsBean();
38 public static Object getNestedProperty(Object bean, String name) {
40 return BeanUtils.PUB.getNestedProperty(bean, name);
41 } catch (Exception e) {
42 LOGGER.warn("Enable to retrieve nested property name=" + name, e);
53 public static void setNestedProperty(Object bean, String name, Object value) {
55 BeanUtils.PUB.setNestedProperty(bean, name, value);
56 } catch (Exception ex) {
57 LOGGER.warn("Enable to set nested property name=" + name + " value=" + value, ex);