Class BeansAccess<T>


  • public abstract class BeansAccess<T>
    extends Object
    Allow access reflect field using runtime generated accessor. BeansAccessor is faster than java.lang.reflect.Method.invoke()
    Author:
    uriel Chemouni
    • Constructor Detail

      • BeansAccess

        public BeansAccess()
    • Method Detail

      • setAccessor

        protected void setAccessor​(Accessor[] accs)
      • getAccessors

        public Accessor[] getAccessors()
      • get

        public static <P> BeansAccess<P> get​(Class<P> type)
        return the BeansAccess corresponding to a type
        Parameters:
        type - to be access
        Returns:
        the BeansAccess
      • get

        public static <P> BeansAccess<P> get​(Class<P> type,
                                             FieldFilter filter)
        return the BeansAccess corresponding to a type
        Parameters:
        type - to be access
        Returns:
        the BeansAccess
      • set

        public abstract void set​(T object,
                                 int methodIndex,
                                 Object value)
        set field value by field index
      • get

        public abstract Object get​(T object,
                                   int methodIndex)
        get field value by field index
      • newInstance

        public abstract T newInstance()
        create a new targeted object
      • set

        public void set​(T object,
                        String methodName,
                        Object value)
        set field value by fieldname
      • get

        public Object get​(T object,
                          String methodName)
        get field value by fieldname
      • getIndex

        public int getIndex​(String name)
        Returns the index of the field accessor.