You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pivot.apache.org by "Niclas Hedhman (JIRA)" <ji...@apache.org> on 2011/02/08 04:09:57 UTC

[jira] Issue Comment Edited: (PIVOT-703) Allow BXMLSerializer.bind() to access superclass fields

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

Niclas Hedhman edited comment on PIVOT-703 at 2/8/11 3:09 AM:
--------------------------------------------------------------

To get all private fields of a class and its superclasses;

   public static List<Field> fieldsOf( Class clazz )
   {
       List<Field> fields = new ArrayList<Field>();
       addFields( clazz, fields );
       return fields;
   }

   private static void addFields( Class clazz, List<Field> fields )
   {
       if( clazz != null && !clazz.equals( Object.class ) )
       {
           fields.addAll( asList( clazz.getDeclaredFields() ) );
           addFields( clazz.getSuperclass(), fields );
       }
   }


      was (Author: niclas):
    To get all private fields of a class and its superclasses;

   public static List<Field> fieldsOf( Class clazz )
   {
       List<Field> fields =3D new ArrayList<Field>();
       addFields( clazz, fields );
       return fields;
   }

   private static void addFields( Class clazz, List<Field> fields )
   {
       if( clazz !=3D null && !clazz.equals( Object.class ) )
       {
           fields.addAll( asList( clazz.getDeclaredFields() ) );
           addFields( clazz.getSuperclass(), fields );
       }
   }

  
> 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