pivot-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Niclas Hedhman (JIRA)" <j...@apache.org>
Subject [jira] Commented: (PIVOT-703) Allow BXMLSerializer.bind() to access superclass fields
Date Tue, 08 Feb 2011 02:44:57 GMT

    [ https://issues.apache.org/jira/browse/PIVOT-703?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12991772#comment-12991772
] 

Niclas Hedhman commented on PIVOT-703:
--------------------------------------

Current and proposed implementation seems to only worry about public fields (no setAccessible()
present, but is perhaps done elsewhere) so getFields() is most convenient to do, but there
is value in doing injection on private fields;

Proper private field injection should loop through the super-classes, do getDeclaredFields()
and for each field it needs to inject do a field.setAccessible(true) and field.set( obj, value
).

What is important to know about reflection;

  * getDeclaredFields() only gets all field on the queried class. getFields() returns all
public fields in the queried class and its superclasses.

  * Without setAccessible(true), it is not possible to set private members. 



> Allow BXMLSerializer.bind() to access superclass fields
> -------------------------------------------------------
>
>                 Key: PIVOT-703
>                 URL: https://issues.apache.org/jira/browse/PIVOT-703
>             Project: Pivot
>          Issue Type: Improvement
>          Components: core-beans
>    Affects Versions: 2.0
>         Environment: Windows XP SP3, Java version "1.6.0_23"
>            Reporter: Roger Whitcomb
>            Priority: Minor
>              Labels: features
>             Fix For: 2.0.1
>
>         Attachments: diff
>
>   Original Estimate: 1h
>  Remaining Estimate: 1h
>
> Loading a standard object from a BXML file (such as a "Dialog") so that the code to bind
to a superclass when the Bindable interface is present on the serialized object is not exercised,
allow "bind" to find public fields in a superclass by calling "getField()" if "getDeclaredField()"
fails.

-- 
This message is automatically generated by JIRA.
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Mime
View raw message