1 Reply Latest reply on Oct 12, 2012 7:25 AM by Michel Werren

    Marshaller and Generics

    Michel Werren Novice

      Hello together

       

      I have a hard problem with marshalling parametrited types. I try to bring the following example to work.

       

       

      public interface MyInterface<T>{

           ...

           public T getValue();

           public void setValue(T value);

           ...

      }

       

      public abstract class MyAbstractClass<T> implements MyInterface<T>{

           ...

           private T value;

       

           protected MyAbstractClass(..., T value, ...){

                this.value = value;

           }

       

           public T getValue() {

                return value;

           }

           public void setValue(T value) {

                this.value = value;

           }

           ...

      }

       

      @Portable

      public class MyConcreteClass extends MyAbstractClass<T> {

           public MyConcreteClass(..., T value, ...){

                super(..., T value, ...);

           }

      }

       

       

      @Portable

      public class Dto {

       

           private MyConcreteClass<ValueTypeOne> firstDtoField;

           private MyConcreteClass<ValueTypeTwo> secondDtoField;

       

           ....

      }

       

       

      I tried with a @CustomMapper but the problem is, that it seem that this mapper will be executed for each reference declaration of MyConcreteClass, because they have a different generic parameter. I dont how i can access the information about this Generics information per declaration via MappingDefinition.

       

      Is there a way to get this information, or is this kind of implementation not possible?

       

      thanks in advance.

       

      Greez Michel