public interface PropertyGetter<T>
class Bean {
TheType beanProp;
public TheType getBeanProp() {
return beanProp;
}
}
PropertyGetter<Bean> pg = ...;
//name = "beanProp"
String name = pg.getPropName(Bean::getBeanProp);
//clz = TheType.class, even if beanProp's actual type is subclass of TheType
Class<?> type = pg.getPropType(Bean::getBeanProp);
| 限定符和类型 | 方法和说明 |
|---|---|
<O> String |
getPropName(BiConsumer<T,O> setter)
Get name of property by invoke setter.
|
<O> String |
getPropName(Function<T,O> getter)
Get name of property by invoke getter.
|
<O> Class<?> |
getPropType(BiConsumer<T,O> setter)
Get type of property by invoke setter.
|
<O> Class<?> |
getPropType(Function<T,O> getter)
Get type of property by invoke getter.
|
default boolean |
supportFieldInvoke()
Whether the direct field invoke is supported.
|
<O> String getPropName(BiConsumer<T,O> setter)
<O> Class<?> getPropType(BiConsumer<T,O> setter)
default boolean supportFieldInvoke()
PropertyGetter pg = ...;
pg.getName(b -> b.beanProp);
Copyright © 2018. All rights reserved.