Record Class Settings

java.lang.Object
java.lang.Record
com.arc_e_tect.gradle.apionly.transcriberj.spi.Settings
Record Components:
contract - the name of the contract, as the project subscribes to it
basePackage - the package the core classes go in
generateDocs - whether descriptions come from the contract; when false, every description is the empty string
descriptionPlaceholder - the description of what the contract does not describe, when generateDocs is true
recursionDepth - how many times a recursive reference is followed before the rest is documented as a subsection
descriptionBundle - the base name of a ResourceBundle the generated classes resolve their descriptions through, or null when the project supplies none; what generation produced is the fallback
invalidRequestStatus - the response status that means "the request is invalid", such as "400"; invalid-request cases are derived only for an operation that declares exactly this status
strictRequests - whether a request object that does not declare additionalProperties forbids members it does not declare, so that an unknown-member case is derived for it
validateFormats - the formats, such as email, an invalid-request case is derived for; never null
emitterOptions - options for each emitter, by the emitter's Emitter.id(): passed through as the project wrote them, never interpreted; never null
derive - the kinds of contract case derived, by their CaseKind.setting() names, in canonical order; never null

public record Settings(String contract, String basePackage, boolean generateDocs, String descriptionPlaceholder, int recursionDepth, String descriptionBundle, String invalidRequestStatus, boolean strictRequests, List<String> validateFormats, Map<String,Map<String,String>> emitterOptions, List<String> derive) extends Record
How a project has asked for one contract's classes to be generated.
  • Field Details

    • DEFAULT_INVALID_REQUEST_STATUS

      public static final String DEFAULT_INVALID_REQUEST_STATUS
      The status that means "the request is invalid" when a project does not say otherwise.
      See Also:
  • Constructor Details

    • Settings

      public Settings(String contract, String basePackage, boolean generateDocs, String descriptionPlaceholder, int recursionDepth, String descriptionBundle, String invalidRequestStatus, boolean strictRequests, List<String> validateFormats, Map<String,Map<String,String>> emitterOptions, List<String> derive)
      Settings as given, with the lists and maps copied so that they cannot change.
      Parameters:
      contract - the name of the contract
      basePackage - the package the core classes go in
      generateDocs - whether descriptions come from the contract
      descriptionPlaceholder - the description of what the contract does not describe
      recursionDepth - how many times a recursive reference is followed
      descriptionBundle - the bundle descriptions resolve through, or null
      invalidRequestStatus - the status meaning "the request is invalid"; null for "400"
      strictRequests - whether an undeclared additionalProperties forbids unknown members
      validateFormats - the formats a case is derived for; null for none
      emitterOptions - the options of each emitter; null for none
      derive - the kinds of case derived; null for every kind
      Throws:
      IllegalArgumentException - when derive names something that is not a kind
    • Settings

      public Settings(String contract, String basePackage, boolean generateDocs, String descriptionPlaceholder, int recursionDepth, String descriptionBundle, String invalidRequestStatus, boolean strictRequests, List<String> validateFormats, Map<String,Map<String,String>> emitterOptions)
      Settings that derive every kind of contract case, as every contract was generated before projects could choose.
      Parameters:
      contract - the name of the contract
      basePackage - the package the core classes go in
      generateDocs - whether descriptions come from the contract
      descriptionPlaceholder - the description of what the contract does not describe
      recursionDepth - how many times a recursive reference is followed
      descriptionBundle - the bundle descriptions resolve through, or null
      invalidRequestStatus - the status meaning "the request is invalid"; null for "400"
      strictRequests - whether an undeclared additionalProperties forbids unknown members
      validateFormats - the formats a case is derived for; null for none
      emitterOptions - the options of each emitter; null for none
    • Settings

      public Settings(String contract, String basePackage, boolean generateDocs, String descriptionPlaceholder, int recursionDepth)
      Settings without a description bundle, as every contract was generated before projects could supply one.
      Parameters:
      contract - the name of the contract
      basePackage - the package the core classes go in
      generateDocs - whether descriptions come from the contract
      descriptionPlaceholder - the description of what the contract does not describe, when generateDocs is true
      recursionDepth - how many times a recursive reference is followed
    • Settings

      public Settings(String contract, String basePackage, boolean generateDocs, String descriptionPlaceholder, int recursionDepth, String descriptionBundle)
      Settings with the invalid-request defaults: status "400", strict requests, no format validation, and no emitter options.
      Parameters:
      contract - the name of the contract
      basePackage - the package the core classes go in
      generateDocs - whether descriptions come from the contract
      descriptionPlaceholder - the description of what the contract does not describe, when generateDocs is true
      recursionDepth - how many times a recursive reference is followed
      descriptionBundle - the bundle descriptions resolve through, or null
  • Method Details

    • derives

      public boolean derives(CaseKind kind)
      Whether a kind of contract case is derived.
      Parameters:
      kind - the kind
      Returns:
      whether derive names it
    • emitterOptions

      public Map<String,String> emitterOptions(String emitterId)
      The options the project gave one emitter.
      Parameters:
      emitterId - the emitter's Emitter.id()
      Returns:
      the options, by name; empty when the project gave it none
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared with Objects::equals(Object,Object); primitive components are compared with '=='.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • contract

      public String contract()
      Returns the value of the contract record component.
      Returns:
      the value of the contract record component
    • basePackage

      public String basePackage()
      Returns the value of the basePackage record component.
      Returns:
      the value of the basePackage record component
    • generateDocs

      public boolean generateDocs()
      Returns the value of the generateDocs record component.
      Returns:
      the value of the generateDocs record component
    • descriptionPlaceholder

      public String descriptionPlaceholder()
      Returns the value of the descriptionPlaceholder record component.
      Returns:
      the value of the descriptionPlaceholder record component
    • recursionDepth

      public int recursionDepth()
      Returns the value of the recursionDepth record component.
      Returns:
      the value of the recursionDepth record component
    • descriptionBundle

      public String descriptionBundle()
      Returns the value of the descriptionBundle record component.
      Returns:
      the value of the descriptionBundle record component
    • invalidRequestStatus

      public String invalidRequestStatus()
      Returns the value of the invalidRequestStatus record component.
      Returns:
      the value of the invalidRequestStatus record component
    • strictRequests

      public boolean strictRequests()
      Returns the value of the strictRequests record component.
      Returns:
      the value of the strictRequests record component
    • validateFormats

      public List<String> validateFormats()
      Returns the value of the validateFormats record component.
      Returns:
      the value of the validateFormats record component
    • emitterOptions

      public Map<String,Map<String,String>> emitterOptions()
      Returns the value of the emitterOptions record component.
      Returns:
      the value of the emitterOptions record component
    • derive

      public List<String> derive()
      Returns the value of the derive record component.
      Returns:
      the value of the derive record component