Binding AAR library to Xamarin.Android, metadata.xml template

345 Views Asked by At

I am creating a binding library for Xamarin.Android from a java AAR file.

Here is the code actually generated after the compilation :

   public interface IParent
   {
   }

   public interface IChild : IParent
   {
   }

   public interface IGetter
   {
       IParent Attribute { get; }
   }

   public class MyClass : IGetter
   {
       public IChild Attribute { get; }    //Not allowed in C# but allowed in Java
   }

The generated code is the basic translation from Java to C#, but is not valid and does not compile.

I would like to modify the Metadata.xml file (or any other) to tell the compilator to generate the following code instead :

public interface IParent
{
}

public interface IChild : IParent
{
}


public interface IGetter<T> where T : IParent
{
    T Attribute { get; }
}

public class MyClass : IGetter<IChild>
{
    public IChild Attribute { get; }   
}

How could I do please ? I have read the documentation but can't achieve it :-(

Thanks a lot for any help !!

0

There are 0 best solutions below