Package net.minidev.asm
Class BeansAccess<T>
- java.lang.Object
-
- net.minidev.asm.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 Summary
Constructors Constructor Description BeansAccess()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description static <P> BeansAccess<P>get(Class<P> type)return the BeansAccess corresponding to a typestatic <P> BeansAccess<P>get(Class<P> type, FieldFilter filter)return the BeansAccess corresponding to a typeabstract Objectget(T object, int methodIndex)get field value by field indexObjectget(T object, String methodName)get field value by fieldnameAccessor[]getAccessors()intgetIndex(String name)Returns the index of the field accessor.HashMap<String,Accessor>getMap()abstract TnewInstance()create a new targeted objectabstract voidset(T object, int methodIndex, Object value)set field value by field indexvoidset(T object, String methodName, Object value)set field value by fieldnameprotected voidsetAccessor(Accessor[] accs)
-
-
-
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
-
newInstance
public abstract T newInstance()
create a new targeted object
-
getIndex
public int getIndex(String name)
Returns the index of the field accessor.
-
-