help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

 x = loci.formats.FormatTools.VERSION;

which is not yet implemented in Octave.

Thank you,
Carnë

[1] https://github.com/openmicroscopy/bioformats/blob/master/components/formats-api/src/loci/formats/FormatTools.java
[2] https://github.com/openmicroscopy/bioformats/blob/master/components/formats-api/src/loci/formats/FormatTools.java#L301

reply via email to

[Prev in Thread] Current Thread [Next in Thread]