Class SchemaHandler

java.lang.Object
v1.sulphurapi.handlers.openapi.SchemaHandler

public class SchemaHandler extends Object
  • Constructor Summary

    Constructors
    Constructor
    Description
    Constructor for SchemaHandler that initializes the user grid and endpoints panel UI.
  • Method Summary

    Modifier and Type
    Method
    Description
    static io.swagger.v3.oas.models.media.Schema<?>
    getSchemaFromContent(io.swagger.v3.oas.models.media.Content content, String mediaType)
    This method retrieves the schema from the content based on the provided media type.
    static io.swagger.v3.oas.models.media.Schema<?>
    This method retrieves the schema from a reference string.
    void
    This method loads the schema properties from the selected media type in the endpoints panel UI and updates the user grid's combo box with the available properties.
    void
     
    static void
    This method resizes the columns of a JTable to fit the content.

    Methods inherited from class java.lang.Object

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

    • SchemaHandler

      public SchemaHandler(APILoader apiLoader)
      Constructor for SchemaHandler that initializes the user grid and endpoints panel UI. It also sets up action listeners for the load endpoint button and send bulk button.
      Parameters:
      bulkGrid - the UserGrid instance to be used for displaying parameters
      endpointsHandler - the EndpointsPanelUI instance to be used for managing endpoints
  • Method Details

    • loadSchemaToUserGrid

      public void loadSchemaToUserGrid()
      This method loads the schema properties from the selected media type in the endpoints panel UI and updates the user grid's combo box with the available properties.
    • sendBulkEvent

      public void sendBulkEvent()
    • tableResizeRenderer

      public static void tableResizeRenderer(JTable table)
      This method resizes the columns of a JTable to fit the content. It iterates through each column, calculates the preferred width based on the header and cell renderers, and sets the preferred width for each column.
      Parameters:
      table - the JTable whose columns need to be resized
    • getSchemaFromContent

      public static io.swagger.v3.oas.models.media.Schema<?> getSchemaFromContent(io.swagger.v3.oas.models.media.Content content, String mediaType)
      This method retrieves the schema from the content based on the provided media type. If the media type is not specified, it returns the schema from the first entry in the content.
      Parameters:
      content - the Content object containing media types and schemas
      mediaType - the media type to look for in the content
      Returns:
      the Schema object if found, otherwise null
    • getValueOfSchemaComponent

      public static io.swagger.v3.oas.models.media.Schema<?> getValueOfSchemaComponent(String ref)
      This method retrieves the schema from a reference string. It checks if the reference is in the format of a component schema and returns the corresponding Schema object.
      Parameters:
      ref - the reference string in the format of "#/components/schemas/{componentName}"
      Returns:
      the Schema object if found, otherwise null