public class LazyGetterMethod extends Object
| Constructor and Description |
|---|
LazyGetterMethod(Object source,
String fieldNames)
Constructs a LazyGetterMethod object for the given source object and
field names as a string separated by '.'
|
| Modifier and Type | Method and Description |
|---|---|
Object |
invoke()
Invokes the getter chain based on the source object.
|
public LazyGetterMethod(Object source, String fieldNames)
LazyGetterMethod#LazyGetterMethod(java.lang.Object, java.lang.String[])
with the second parameter fieldNames.split("\\.").source - The object on which to invoke the first getterfieldNames - The field names which should be used for the getter
determinationpublic Object invoke() throws InvocationTargetException, IllegalAccessException
Example of how the chaining works:
class A{ B getB(){ // return b element } }
class B{ String getA(){ // return a element } }
new LazyGetterMethod(new A(), "a.b").invoke()
is equal to
new A().getB().getA()
InvocationTargetException - Method.invoke(java.lang.Object, java.lang.Object[])IllegalAccessException - Method.invoke(java.lang.Object, java.lang.Object[])Copyright © 2020 Blazebit. All rights reserved.