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

liquibase.util.beans.PropertyUtils Maven / Gradle / Ivy

There is a newer version: 3.6.2.5.inovus
Show newest version
package liquibase.util.beans;

import java.beans.IntrospectionException;
import java.beans.PropertyDescriptor;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

public class PropertyUtils {
    private static final PropertyUtils INSTANCE = new PropertyUtils();

    public static PropertyUtils getInstance() {
        return INSTANCE;
    }

    private final List introspectors = new ArrayList<>(Arrays.asList(new DefaultBeanIntrospector(), new FluentPropertyBeanIntrospector()));

    public PropertyDescriptor[] getDescriptors(Class targetClass) throws IntrospectionException {
        IntrospectionContext context = new IntrospectionContext(targetClass);
        for (BeanIntrospector introspector : introspectors) {
            introspector.introspect(context);
        }
        return context.getDescriptors();
    }

    private PropertyUtils() {
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy