Class ArgumentsAdapter

java.lang.Object
com.google.gson.TypeAdapter<Arguments>
com.suse.salt.netapi.parser.ArgumentsAdapter

public class ArgumentsAdapter extends com.google.gson.TypeAdapter<Arguments>
Json TypeAdapter for Arguments class. Breaks the incoming arguments into args and kwargs parts and fills a new Arguments instance.
  • Field Details

  • Constructor Details

    • ArgumentsAdapter

      public ArgumentsAdapter()
  • Method Details

    • write

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

      public Arguments read(com.google.gson.stream.JsonReader jsonReader) throws IOException
      Specified by:
      read in class com.google.gson.TypeAdapter<Arguments>
      Throws:
      IOException
    • readObjectArgument

      private Map<String,Object> readObjectArgument(com.google.gson.stream.JsonReader jsonReader) throws IOException
      Reads a generic object argument from the given JsonReader.
      Parameters:
      jsonReader - JsonReader expecting an object next
      Returns:
      Map representing a generic object argument
      Throws:
      IOException
    • isKwarg

      private boolean isKwarg(Map<String,Object> arg)
      Checks whether an object argument is kwarg. Object argument is kwarg if it contains __kwarg__ property set to true.
      Parameters:
      arg - object argument to be tested
      Returns:
      true if object argument is kwarg