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 Object
get(T object, int methodIndex)
get field value by field indexObject
get(T object, String methodName)
get field value by fieldnameAccessor[]
getAccessors()
int
getIndex(String name)
Returns the index of the field accessor.HashMap<String,Accessor>
getMap()
abstract T
newInstance()
create a new targeted objectabstract void
set(T object, int methodIndex, Object value)
set field value by field indexvoid
set(T object, String methodName, Object value)
set field value by fieldnameprotected void
setAccessor(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.
-
-