[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Octave-bug-tracker] [bug #41239] Dot notation for accessing Java static
From: |
Rik |
Subject: |
[Octave-bug-tracker] [bug #41239] Dot notation for accessing Java static class fields |
Date: |
Wed, 15 Jan 2014 19:18:41 +0000 |
User-agent: |
Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:26.0) Gecko/20100101 Firefox/26.0 |
Update of bug #41239 (project octave):
Item Group: Regression => Matlab Compatibility
Status: None => Postponed
Summary: java_get/-set removed in dev (4.1.0+) w/o
replacement for static fields => Dot notation for accessing Java static class
fields
_______________________________________________________
Follow-up Comment #1:
There are two parts to this. Eventually we will have Matlab compatibility.
See
http://www.mathworks.com/help/matlab/matlab_external/creating-and-using-java-objects.html,
and in particular the section "Accessing Data from a Static Field" for the way
things will work.
For reading a static class value Matlab supports standard dot notation such
as
int_type = java.lang.Integer.TYPE
This sort of dot notation should be possible when classdef support is
available, but that is a ways off (4.2 release).
Note that in Matlab reading a class value is possible using the notation
above, but writing to a class value *always* requires creating an instance of
the class first and then assigning to that instance.
In Octave, reading and writing of static class values is already supported
with this two step approach. An example of reading the TYPE field is
jint = javaObject ("java.lang.Integer", 1);
int_type = jint.TYPE;
int_type.toString
ans = int
Changing your example over to the supported syntax
obj = javaObject ("org.apache.poi.ss.usermodel.Cell");
ctype(1) = obj.CELL_TYPE_NUMERIC;
And it may not even require the instantiation of the object "obj" because you
may already have an instance of the class in the previous code.
This style of code for reading is perfectly acceptable Matlab syntax so it
will not go away even when 4.2 is released. If you want to change over code
to use the two-step read sequence you can then have your choice to update it
to dot notation in 4.2 or just leave it as is because it works.
_______________________________________________________
Reply to this item at:
<http://savannah.gnu.org/bugs/?41239>
_______________________________________________
Message sent via/by Savannah
http://savannah.gnu.org/