static boolean fieldIsSerializable ( final Field field , final boolean onlySerializePublicFields ) { final int modifiers = field . getModifiers ( ) ; if ( ( ! onlySerializePublicFields || Modifier . isPublic ( modifiers ) ) && ! Modifier . isTransient ( modifiers ) && ! Modifier . isFinal ( modifiers ) && ( ( modifiers & 0x1000 /* synthetic */ ) == 0 ) ) { return JSONUtils . isAccessibleOrMakeAccessible ( field ) ; } return false ; }
Check if a field is serializable . Don t serialize transient final synthetic or inaccessible fields .