3 Replies Latest reply: Jan 8, 2010 5:15 AM by 791266 RSS

    Reflection and Wrapper

      Now I got 2 objects which from different classes ClassA and ClassB but they have exactly same attributes. ClassA and ClassB is not interface. Assume that ClassB can not be modify.
      Can wrapper wrap classB into classA? For what I know wrapper can wrap primitive class into object type. As for reflection can retireve classB field and set it to classA but due to the security concern, can wrapper do that?
      public ClassA retrieveDetails(int id) {
         ClassA classA = null; 
         ClassB classB =  null;
         // Error occur here classB.retrieveDetails(id) this method return ClassB instead of ClassA
         classA =  classB.retrieveDetails(id);
         return classA;