xworker.javafx.beans.property.PropertyFactory Maven / Gradle / Ivy
package xworker.javafx.beans.property;
import javafx.beans.property.*;
import javafx.scene.control.TextInputControl;
import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
import java.util.HashMap;
import java.util.Map;
import java.util.function.Function;
/**
* 由于使用Graalvm打包成Native Image时Ognl等脚本语言因反射的原因失败,因此在此人工注册方法。
*/
public class PropertyFactory {
private static final Map, Map>>> propertyGetters = new HashMap<>();
static{
regist(TextInputControl.class, "editableProperty", o -> {
TextInputControl obj = (TextInputControl) o;
return obj.editableProperty();
});
}
public static void regist(Class cls, String name, Function