axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Amila Chinthaka Suriarachchi (JIRA)" <j...@apache.org>
Subject [jira] Commented: (AXIS2-4235) DefaultObjectSupplier cannot attach inner classes to the proper enclosing class instance
Date Mon, 27 Dec 2010 03:24:46 GMT

    [ https://issues.apache.org/jira/browse/AXIS2-4235?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12975192#action_12975192
] 

Amila Chinthaka Suriarachchi commented on AXIS2-4235:
-----------------------------------------------------

yes the class should looks like this,

public class TestPOJO {

    private String parentName;

    private Inner innernInner;

    public String getParentName() {
        return parentName;
    }

    public void setParentName(String parentName) {
        this.parentName = parentName;
    }

    public Inner getInnernInner() {
        return innernInner;
    }

    public void setInnernInner(Inner innernInner) {
        this.innernInner = innernInner;
    }

    class Inner {
        private String innerName;

        public String getInnerName() {
            return innerName;
        }

        public void setInnerName(String innerName) {
            this.innerName = innerName;
        }
    }
}

If so I am ok to apply this change with the suggestions made by Andreas. Please provide a
patch. 

> DefaultObjectSupplier cannot attach inner classes to the proper enclosing class instance
> ----------------------------------------------------------------------------------------
>
>                 Key: AXIS2-4235
>                 URL: https://issues.apache.org/jira/browse/AXIS2-4235
>             Project: Axis2
>          Issue Type: Bug
>          Components: adb, kernel
>    Affects Versions: 1.5, 1.4.1, 1.4
>            Reporter: Detelin Yordanov
>            Assignee: Andreas Veithen
>
> Тhe default implementation of the ObjectSupplier interface is not capable of creating
inner classes and attaching them to an already created parent instance. For example, suppose
we have the following class hierarchy:
> class Parent {
>   String name;
>   get/setName() { .. }
>  
>   class Inner {
>       String innerName;
>    }
> }
> Transformed into XML, thiis should look sth. like:
> <Parent>
>    <name>ParentName</name>
>    <Inner>
>        <innerName>InnerName</innerName>
>    </Inner>
> </Parent>
> When ADB is parsing this, it will first invoke the ObjectSupplier requesting an instance
of Parent.class, the created instance will be populated, setting its
> name to "ParentName".
> Then, ADB will proceed to create the Inner class instance, however now it will not use
the already created Parent, but will create a new one (see DefaultObjectSupplier#getObject(..)).
Thus the Inner class instance will have an internal reference to a newly initialized Parent
instance, rather than to the already initialized and populated Parent instance. This means
that the Inner class will see the Parent's name field as null, instead as "ParentName".
> A possible, but not backward compatible solution would be to extend the ObjectSupplier
interface (or create a new interface) adding a new method:
> public Object getObject(Object parentObj, Class clazz)
> The method should use the provided parentObj instance if the given "clazz" is an inner
class and "parentObj" is an instance of its enclosing class.
> The other change would be to modify the ADB BeanUtil and pass the corresponding parent
instance on each call to the ObjectSupplier.
> If this solution is acceptable, I could provide a patch.
> Regards,
>    Detelin
>    

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscribe@axis.apache.org
For additional commands, e-mail: java-dev-help@axis.apache.org


Mime
View raw message