Class JsonSerializer

java.lang.Object
org.reflections.serializers.JsonSerializer
All Implemented Interfaces:
Serializer

public class JsonSerializer extends Object implements Serializer
serialization of Reflections to json

an example of produced json:

 {"store":{"storeMap":
    {"org.reflections.scanners.TypeAnnotationsScanner":{
       "org.reflections.TestModel$AC1":["org.reflections.TestModel$C1"],
       "org.reflections.TestModel$AC2":["org.reflections.TestModel$I3",
 ...
 
  • Field Details

    • gson

      private com.google.gson.Gson gson
  • Constructor Details

    • JsonSerializer

      public JsonSerializer()
  • Method Details

    • read

      public Reflections read(InputStream inputStream)
      Description copied from interface: Serializer
      reads the input stream into a new Reflections instance, populating it's store
      Specified by:
      read in interface Serializer
    • save

      public File save(Reflections reflections, String filename)
      Description copied from interface: Serializer
      saves a Reflections instance into the given filename
      Specified by:
      save in interface Serializer
    • toString

      public String toString(Reflections reflections)
      Description copied from interface: Serializer
      returns a string serialization of the given Reflections instance
      Specified by:
      toString in interface Serializer
    • getGson

      private com.google.gson.Gson getGson()