Hello
I try to run a method which retrieves a string on an object using the jReflection library.
Here is a testcase:
I have an class named "MyObject"
So I try to run getName so I receive the name of the instance. I now have this code:
I always run into an error stating that _getname doesn't exist. "getname" and "getName" also won't work.
While in the java files, "_getname" really exists:
What am I missing here?
Thanks a bunch!
I try to run a method which retrieves a string on an object using the jReflection library.
Here is a testcase:
I have an class named "MyObject"
B4X:
Sub Class_Globals
Private mName As String
End Sub
Public Sub Initialize(Name As String)
mName = Name
End Sub
Public Sub getName As String
Return mName
End Sub
So I try to run getName so I receive the name of the instance. I now have this code:
B4X:
Dim mo As MyObject
mo.Initialize("Testname")
Dim reflect As Reflector
reflect.Target = mo
Log(reflect.RunMethod("_getname"))
'Log(reflect.RunMethod("getname"))
'Log(reflect.RunMethod("getName"))
I always run into an error stating that _getname doesn't exist. "getname" and "getName" also won't work.
While in the java files, "_getname" really exists:
Java:
public String _getname(b4j.example.myobject __ref) throws Exception{
__ref = this;
RDebugUtils.currentModule="myobject";
if (Debug.shouldDelegate(ba, "getname", false))
{return ((String) Debug.delegate(ba, "getname", null));}
RDebugUtils.currentLine=720896;
//BA.debugLineNum = 720896;BA.debugLine="Public Sub getName As String";
RDebugUtils.currentLine=720897;
//BA.debugLineNum = 720897;BA.debugLine="Return mName";
if (true) return __ref._mname /*String*/ ;
RDebugUtils.currentLine=720898;
//BA.debugLineNum = 720898;BA.debugLine="End Sub";
return "";
}
What am I missing here?
Thanks a bunch!