From e02d999e7f436f481eaca01f0693272f85015f20 Mon Sep 17 00:00:00 2001 From: Villu Ruusmann Date: Thu, 15 Jun 2023 13:20:26 +0300 Subject: [PATCH] Improved commit 36f352c9cc --- .../src/main/java/org/jpmml/h2o/Converter.java | 18 +----------------- 1 file changed, 1 insertion(+), 17 deletions(-) diff --git a/pmml-h2o/src/main/java/org/jpmml/h2o/Converter.java b/pmml-h2o/src/main/java/org/jpmml/h2o/Converter.java index fceebcb..d2ccb44 100644 --- a/pmml-h2o/src/main/java/org/jpmml/h2o/Converter.java +++ b/pmml-h2o/src/main/java/org/jpmml/h2o/Converter.java @@ -76,7 +76,7 @@ public Schema toMojoModelSchema(Schema schema){ public PMML encodePMML(){ M model = getModel(); - ModelDescriptor modelDescriptor = getModelDescriptor(model); + ModelDescriptor modelDescriptor = model._modelDescriptor; H2OEncoder encoder = new H2OEncoder(); @@ -107,11 +107,6 @@ private void setModel(M model){ this.model = Objects.requireNonNull(model); } - static - public ModelDescriptor getModelDescriptor(MojoModel model){ - return (ModelDescriptor)getFieldValue(Converter.FIELD_MODEL_DESCRIPTOR, model); - } - static protected Class getDeclaredClass(Class clazz, String name) throws ReflectiveOperationException { String subclassName = clazz.getName() + "$" + name; @@ -145,15 +140,4 @@ protected Object getFieldValue(Field field, Object object){ throw new RuntimeException(roe); } } - - private static final Field FIELD_MODEL_DESCRIPTOR; - - static { - - try { - FIELD_MODEL_DESCRIPTOR = MojoModel.class.getDeclaredField("_modelDescriptor"); - } catch(ReflectiveOperationException roe){ - throw new RuntimeException(roe); - } - } } \ No newline at end of file