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
15 package org.onap.nbi.commons;
17 import org.apache.commons.beanutils.PropertyUtilsBean;
18 import org.slf4j.Logger;
19 import org.slf4j.LoggerFactory;
24 public class BeanUtils {
26 private static final Logger LOGGER = LoggerFactory.getLogger(BeanUtils.class);
28 private static final PropertyUtilsBean PUB = new PropertyUtilsBean();
39 public static Object getNestedProperty(Object bean, String name) {
41 return BeanUtils.PUB.getNestedProperty(bean, name);
42 } catch (Exception e) {
43 LOGGER.warn("Enable to retrieve nested property name=" + name, e);
54 public static void setNestedProperty(Object bean, String name, Object value) {
56 BeanUtils.PUB.setNestedProperty(bean, name, value);
57 } catch (Exception ex) {
58 LOGGER.warn("Enable to set nested property name=" + name + " value=" + value, ex);