protected void writeArbitraryObject ( Object object ) { log . debug ( "writeObject" ) ; // If we need to serialize class information... Class < ? > objectClass = object . getClass ( ) ; if ( ! objectClass . isAnnotationPresent ( Anonymous . class ) ) { // Write out start object marker for class name buf . put ( AMF . TYPE_CLASS_OBJECT ) ; putString ( buf , Serializer . getClassName ( objectClass ) ) ; } else { // Write out start object marker without class name buf . put ( AMF . TYPE_OBJECT ) ; } // Iterate thru fields of an object to build "name-value" map from it for ( Field field : objectClass . getFields ( ) ) { String fieldName = field . getName ( ) ; log . debug ( "Field: {} class: {}" , field , objectClass ) ; // Check if the Field corresponding to the getter/setter pair is transient if ( ! serializeField ( objectClass , fieldName , field , null ) ) { continue ; } Object value ; try { // Get field value value = field . get ( object ) ; } catch ( IllegalAccessException err ) { // Swallow on private and protected properties access exception continue ; } // Write out prop name putString ( buf , fieldName ) ; // Write out Serializer . serialize ( this , field , null , object , value ) ; } // write out end of object marker buf . put ( AMF . END_OF_OBJECT_SEQUENCE ) ; }
Writes an arbitrary object to the output .