[mono-android] transforming a property in a java library project
Wally McClure
theevilprogrammer at hotmail.com
Tue Jun 26 01:30:53 UTC 2012
To follow up on this some more:I just remembered that Java has the getX and setX as the common property accessors. Not being a java developer, I missed that. I have the following code in my .java file:
private int _val;
public int getValue()
{
return _val;
}
public void setValue(int val)
{
_val = val;
} I have compiled my code in eclipse and have added my .jar file to my java binding library project.In EnumMethods.xml file, I have the following:
<method jni-name="getValue" parameter="return"
clr-enum-type="Com.Scalabledevelopment.Math.Operations.Value" />
I was hoping that I would then be able to access my property via:var obj = new Com.Scalabledevelopment.Math.Operations();obj.Value = 1; Unfortunately, I am not seeing a property called .Value. The only thing that I see within the object is .setValue(int). Is there anyway to create gets/sets for properties? Wally
From: theevilprogrammer at hotmail.com
To: monodroid at lists.ximian.com
Date: Mon, 25 Jun 2012 16:23:21 -0400
Subject: Re: [mono-android] transforming a property in a java library project
<!--
.ExternalClass .ecxhmmessage P
{padding:0px;}
.ExternalClass body.ecxhmmessage
{font-size:10pt;font-family:Tahoma;}
-->
As a followup to this, I am getting a bunch of generator.exe errors that look like this:
------ Build started: Project: BindingLibrary, Configuration: Debug Any CPU ------
C:\Program Files (x86)\MSBuild\Novell\Xamarin.Android.Bindings.targets(197,5): error MSB6006: "generator.exe" exited with code -532462766.
------ Build started: Project: ExampleJavaBindings, Configuration: Debug Any CPU ------
========== Build: 0 succeeded or up-to-date, 2 failed, 0 skipped ==========
From: theevilprogrammer at hotmail.com
To: monodroid at lists.ximian.com
Subject: transforming a property in a java library project
Date: Mon, 25 Jun 2012 15:51:18 -0400
I have created a class called operations in .java file in eclipse. Everything compiles as intended in Eclipse. I want to then import my jar file into a java binding project in MfA 4.2. I have INTENTIONALLY created a property in java that will result in a conflict with an initializer in C#. My question is how do I go about fixing this via the transform .xml files?
In the EnumMethods.xml file, I have tried:
<mapping jni-class="com/scalabledevelopment/math/Operations">
<method jni-name="Operations" parameter="Operations"
clr-enum-type="FixedOperations" />
</mapping>
as will as:
<mapping jni-class="com/scalabledevelopment/math/Operations">
<method jni-name="Operations"
clr-enum-type="FixedOperations" />
</mapping>
Neither of the above options helps me.
I have tried to go into Metadata.xml and use the following:
<attr path="/api/package[@name='com.scalabledevelopment.math']/class[@name='Operations']/property[@name='Operations']" name="managedName" >NumOperations</attr>
Unfortunately, I have no luck there as well.
My other option is to go into the source file at obj/Debug/generated/src/.cs file. I can fix the error there, but won't the file be overwritten the next time I perform a compile?
Ideas, thoughts, and whatever are appreciated.
Wally
_______________________________________________
Monodroid mailing list
Monodroid at lists.ximian.com
UNSUBSCRIBE INFORMATION:
http://lists.ximian.com/mailman/listinfo/monodroid
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ximian.com/pipermail/monodroid/attachments/20120625/8cdcec91/attachment-0001.html>
More information about the Monodroid
mailing list