Class FileAdapter

java.lang.Object
com.google.gson.TypeAdapter<File>
cambio.simulator.parsing.adapter.FileAdapter

public class FileAdapter extends com.google.gson.TypeAdapter<File>
Gson TypeAdapter for the File type.

This adapter is mandatory since Javas' stricter reflection rules. This adapter converts Files to Strings and vise-versa using the files' absolut path.

Author:
Lion Wagner
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    read(com.google.gson.stream.JsonReader reader)
     
    void
    write(com.google.gson.stream.JsonWriter out, File value)
     

    Methods inherited from class com.google.gson.TypeAdapter

    fromJson, fromJson, fromJsonTree, nullSafe, toJson, toJson, toJsonTree

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • FileAdapter

      public FileAdapter()
  • Method Details

    • write

      public void write(com.google.gson.stream.JsonWriter out, File value) throws IOException
      Specified by:
      write in class com.google.gson.TypeAdapter<File>
      Throws:
      IOException
    • read

      public File read(com.google.gson.stream.JsonReader reader) throws IOException
      Specified by:
      read in class com.google.gson.TypeAdapter<File>
      Throws:
      IOException