Class BeanHelper

java.lang.Object
com.univocity.parsers.common.beans.BeanHelper

public final class BeanHelper extends Object
Helper class used to obtain property descriptors from annotated java beans whose values are set via reflection. This class was implemented to eliminate direct compile-time dependency with Introspector and other classes in the java.beans.* package. This is required to allow Android developers to use univocity-parsers. Android developers should add have openbeans-1.0.jar in their classpath to be able to use univocity-parsers. When available, the classes from package com.googlecode.openbeans.* will be used, otherwise the bean introspection classes classes from java.beans.* package will be loaded. If everything fails, then the parser will try to manipulate fields in annotated java beans directly, instead of using their getters and setters.
  • Field Details

    • EMPTY

      private static final PropertyWrapper[] EMPTY
    • introspectorClass

      private static final Class<?> introspectorClass
    • beanInfoMethod

      private static final Method beanInfoMethod
    • propertyDescriptorMethod

      private static final Method propertyDescriptorMethod
    • PROPERTY_WRITE_METHOD

      static Method PROPERTY_WRITE_METHOD
    • PROPERTY_READ_METHOD

      static Method PROPERTY_READ_METHOD
    • PROPERTY_NAME_METHOD

      static Method PROPERTY_NAME_METHOD
    • descriptors

      private static final Map<Class<?>,WeakReference<PropertyWrapper[]>> descriptors
  • Constructor Details

    • BeanHelper

      private BeanHelper()
  • Method Details

    • getPropertyDescriptors

      public static PropertyWrapper[] getPropertyDescriptors(Class<?> beanClass)
      Returns the property descriptors of all properties available from a class
      Parameters:
      beanClass - the class whose property descriptors should be returned
      Returns:
      an array of all property descriptors of the given class. Might be empty.
    • findIntrospectorImplementationClass

      private static Class<?> findIntrospectorImplementationClass()
    • getBeanInfoMethod

      private static Method getBeanInfoMethod()
    • getMethod

      private static Method getMethod(String methodName, Method method, boolean fromComponentType)