Class AbstractRequest

java.lang.Object
pro.mypvit.requests.AbstractRequest
Direct Known Subclasses:
BaseTransactionRequest

public abstract class AbstractRequest extends Object
Abstract base class for all request objects in the MyPVit SDK. This class provides a shared functionality to convert request objects to JSON format, ensuring consistent serialization with a specified field naming policy. Features:
  • Uses SuperBuilder for enabling builder pattern in subclasses.
  • Provides a utility method for converting the object to JSON using Gson.
Serialization Policy: The field naming policy for JSON serialization is set to FieldNamingPolicy.LOWER_CASE_WITH_UNDERSCORES, ensuring that field names in JSON match the snake_case naming convention used in the API.
  • Constructor Details

    • AbstractRequest

      public AbstractRequest()
      Default constructor
  • Method Details

    • toJson

      public String toJson()
      Converts the current object to its JSON representation. This method uses a pre-configured Gson instance to serialize the object, ensuring that the JSON follows the field naming policy.
      Returns:
      A JSON string representation of the object.