All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.katharsis.utils.BeanUtils Maven / Gradle / Ivy

There is a newer version: 2.6.3
Show newest version
package io.katharsis.utils;

/**
 * Bean utils based on Katharsis PropertyUtils
 */
public class BeanUtils {

    /**
     * Get bean's property value and maps to String
     *
     * @see io.katharsis.utils.PropertyUtils#getProperty(Object, String)
     *
     * @param bean  bean to be accessed
     * @param field bean's field
     * @return bean's property value
     */
    public static String getProperty(Object bean, String field) {
        Object property = PropertyUtils.getProperty(bean, field);
        if (property == null) {
            return "null";
        }

        return property.toString();
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy