retrieving a fields of java object with a private constructor
From:
Carnë Draug
Subject:
retrieving a fields of java object with a private constructor
Date:
Mon, 7 Jul 2014 23:24:44 +0100
Hi
to access a field from a java object, I would usually do:
x = javaObject (class_name).field_name;
However, the class I am trying to use now (loci.formats.FormatTools) [1] does not have a public constructor [2] so the previous fails:
> a = javaObject ('loci.formats.FormatTools') Exception in thread "main" java.lang.NoSuchMethodException: loci.formats.FormatTools at org.octave.ClassHelper.invokeConstructor(ClassHelper.java:402)
error: [java] java.lang.NoSuchMethodException: loci.formats.FormatTools
This is a not a bug as indeed there is no constructor. How can I access a field value in this case? I am specifically trying to access the field VERSION. It seems that in Matlab, aside the functional form of interacting with java (javaObject and javaMethod), one can do