Commit fb1a1c12 authored by Olivier Aubert's avatar Olivier Aubert

python-ctypes: define a .value() method for enums in java code

ATM, java bindings use Enum.ordinal() to convert the enum name to its value. However, this approach is broken in the case of discontinuous enums such as libvlc_media_option_t.
Java bindings maintainers should convert their code to use the enum.value() method.
parent 5ba19660
......@@ -854,7 +854,11 @@ public enum %s
# FIXME: write comment
for k, v in values:
self.output(fd, " %s, // %s," % (k, v))
self.output(fd, " %s (%s)," % (k, v))
self.output(fd, "");
self.output(fd, " private final int _value;");
self.output(fd, " %s(int value) { this._value = value; }" % javaname);
self.output(fd, " public int value() { return this._value; }");
self.output(fd, "}")
fd.close()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment