Package net.minidev.asm
Class BeansAccess<T>
java.lang.Object
net.minidev.asm.BeansAccess<T>
- Type Parameters:
T- the type of the bean being accessed
Allow access reflect field using runtime generated accessor. BeansAccessor is faster than
java.lang.reflect.Method.invoke()
- Author:
- uriel Chemouni
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic <P> BeansAccess<P>return the BeansAccess corresponding to a typestatic <P> BeansAccess<P>get(Class<P> type, FieldFilter filter) return the BeansAccess corresponding to a typeabstract Objectget field value by field indexget field value by field nameAccessor[]get internal accessorintReturns the index of the field accessor.getMap()get internal mapabstract Tcreate a new targeted objectabstract voidset field value by field indexvoidset field value by field nameprotected voidsetAccessor(Accessor[] accs) set Accessor
-
Constructor Details
-
BeansAccess
public BeansAccess()default constuctor
-
-
Method Details
-
setAccessor
set Accessor- Parameters:
accs- Accessor list
-
getMap
get internal map- Returns:
- a map
-
getAccessors
get internal accessor- Returns:
- Accessor list
-
get
return the BeansAccess corresponding to a type- Type Parameters:
P- working type- Parameters:
type- to be access- Returns:
- the BeansAccess
-
get
return the BeansAccess corresponding to a type- Type Parameters:
P- working type- Parameters:
filter- FieldFiltertype- to be access- Returns:
- the BeansAccess
-
set
set field value by field index- Parameters:
object- object to altermethodIndex- field id to updatevalue- new value
-
get
get field value by field index- Parameters:
object- object to operatemethodIndex- field number to operate- Returns:
- value of the field
-
newInstance
create a new targeted object- Returns:
- new instance
-
set
set field value by field name- Parameters:
object- target objectmethodName- methodNamevalue- new field value
-
get
get field value by field name- Parameters:
object- object to operatemethodName- getter to call- Returns:
- field value returned by the getter
-
getIndex
Returns the index of the field accessor.- Parameters:
name- field name- Returns:
- id of the field
-