-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
API Enhancements #18
API Enhancements #18
Conversation
77976f7
to
ffa9bf7
Compare
func GetField(_ fieldName: String, fieldJavaClassName: String, from javaObject: JavaObject) throws -> JavaObject { | ||
let env = self._env | ||
let javaClass = try GetObjectClass(obj: javaObject) | ||
let fieldID = env.pointee.pointee.GetFieldID(env, javaClass, fieldName, "L\(fieldJavaClassName);") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure but I think we might need to delete the local ref to the class here after we use it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh yes, totally oversaw this. we do it also in the other methods above :+1
@@ -87,6 +87,10 @@ open class JNIObject { | |||
return try jni.GetField(fieldName, from: self.instance) | |||
} | |||
|
|||
public func getField(_ fieldName: String, fieldJavaClassName: String) throws -> JavaObject { | |||
return try jni.GetField(fieldName, fieldJavaClassName: fieldJavaClassName, from: self.instance) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cool looks good, ideally we'd add getters for primitive fields too (Int etc) but we can also do that later when/if we need it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think what you mean is already covered by the generic methods above.
|
||
func GetDirectBufferAddress(buffer: JavaObject) -> UnsafeMutableRawPointer? { | ||
let env = self._env | ||
return env.pointee.pointee.GetDirectBufferAddress(env, buffer) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👌
Adds new public APIs: