question: private void serializeClass ( Class clazz , Map < String , List < String > > classFields ) throws RuntimeException { File current = new File ( getCurrentDirectory ( ) ) ; if ( ! current . exists ( ) || ! current . isDirectory ( ) ) { throw new IllegalStateException ( "There is no " + current . getAbsolutePath ( ) + " directory. " + "\nThis is where the serialized classes should be. " + "Please run serializeCurrentDirectory() first." ) ; } try { Field field = clazz . getDeclaredField ( "serialVersionUID" ) ; int modifiers = field . getModifiers ( ) ; boolean _static = Modifier . isStatic ( modifiers ) ; boolean _final = Modifier . isFinal ( modifiers ) ; field . setAccessible ( true ) ; if ( ! _static || ! _final || ! ( 23L == field . getLong ( null ) ) ) { throw new RuntimeException ( "Class " + clazz + " does not define static final " + "long serialVersionUID = 23L" ) ; } int numFields = getNumNonSerialVersionUIDFields ( clazz ) ; if ( numFields > 0 ) { Method method = clazz . getMethod ( "serializableInstance" ) ; Object object = method . invoke ( null ) ; File file = new File ( current , clazz . getName ( ) + ".ser" ) ; boolean created = file . createNewFile ( ) ; FileOutputStream out = new FileOutputStream ( file ) ; ObjectOutputStream objOut = new ObjectOutputStream ( out ) ; objOut . writeObject ( object ) ; out . close ( ) ; } ObjectStreamClass objectStreamClass = ObjectStreamClass . lookup ( clazz ) ; String className = objectStreamClass . getName ( ) ; ObjectStreamField [ ] fields = objectStreamClass . getFields ( ) ; @ SuppressWarnings ( "Convert2Diamond" ) List < String > fieldList = new ArrayList < > ( ) ; for ( ObjectStreamField objectStreamField : fields ) { String fieldName = objectStreamField . getName ( ) ; fieldList . add ( fieldName ) ; } classFields . put ( className , fieldList ) ; } catch ( NoSuchFieldException e ) { throw new RuntimeException ( ( "There is no static final long field " + "'serialVersionUID' in " + clazz + ". Please make one and set it " + "to 23L." ) ) ; } catch ( NoSuchMethodException e ) { } catch ( IllegalAccessException e ) { throw new RuntimeException ( "The method serializableInstance() of " + "class " + clazz + " is not public." , e ) ; } catch ( InvocationTargetException e ) { throw new RuntimeException ( "Unable to statically call the " + "serializableInstance() method of class " + clazz + "." , e ) ; } catch ( IOException e ) { throw new RuntimeException ( "Could not create a new, writeable file " + "in " + getCurrentDirectory ( ) + " when trying to serialize " + clazz + "." , e ) ; } }
target:  Serializes the given class to the getCurrentDirectory() directory. The static serializedInstance() method of clazz will be called to get an examplar of clazz. This examplar will then be serialized out to a file stored in getCurrentDirectory().