private static Class<?>[] getFields(Class<?> clz)
   {
      List<Class<?>> result = new ArrayList<Class<?>>();

      Class<?> c = clz;
      while (!c.equals(Object.class))
      {
         try
         {
            Field[] fields = SecurityActions.getDeclaredFields(c);
            if (fields.length > 0)
            {
               for (Field f : fields)
               {
                  Class<?> defClz = f.getType();
                  String defClzName = defClz.getName();

                  if (!defClz.isPrimitive() && !defClz.isArray() && 
                      !defClzName.startsWith("java") && !defClzName.startsWith("javax") && !result.contains(defClz))
                  {
                     if (trace)
                        log.tracef("Adding field: %s", defClzName);
                     
                     result.add(defClz);
                  }
               }
            }
         }
         catch (Throwable t)
         {
            // Ignore
         }

         c = c.getSuperclass();
      }

      return result.toArray(new Class<?>[result.size()]);
   }
private static Class < ? > [ ] getFields ( Class < ? > clz ) { List < Class < ? > > result = new ArrayList < Class < ? > > ( ) ; Class < ? > c = clz ; while ( ! c . equals ( Object . class ) ) { try { Field [ ] fields = SecurityActions . getDeclaredFields ( c ) ; if ( fields . length > 0 ) { for ( Field f : fields ) { Class < ? > defClz = f . getType ( ) ; String defClzName = defClz . getName ( ) ; if ( ! defClz . isPrimitive ( ) && ! defClz . isArray ( ) && ! defClzName . startsWith ( "java" ) && ! defClzName . startsWith ( "javax" ) && ! result . contains ( defClz ) ) { if ( trace ) log . tracef ( "Adding field: %s" , defClzName ) ; result . add ( defClz ) ; } } } } catch ( Throwable t ) { } c = c . getSuperclass ( ) ; } return result . toArray ( new Class < ? > [ result . size ( ) ] ) ; }
Get the classes for all the fields
@param clz The class
@return The classes; empty array if none