Class OpenApiSerializer.Builder

Enclosing class:
OpenApiSerializer

Builder class.
  • Constructor Details

  • Method Details

    • build

      Description copied from class: Context.Builder
      Build the object.
      Overrides:
      build in class UonSerializer.Builder<OpenApiSerializer.Builder>
      Returns:
      The built object.
    • collectionFormat

      OpenApiCommon configuration property:  Default collection format for HTTP parts.

      Specifies the collection format to use for HTTP parts when not otherwise specified via Schema.collectionFormat().

      Example:

      // Create a serializer using CSV for collections. OpenApiSerializer serializer1 = OpenApiSerializer .create() .collectionFormat(CSV) .build(); // Create a serializer using UON for collections. OpenApiSerializer serializer2 = OpenApiSerializer .create() .collectionFormat(UON) .build(); // An arbitrary data structure. JsonList list = JsonList.of( "foo", "bar", JsonMap.of( "baz", JsonList.of("qux","true","123") ) ); // Produces: "foo=bar,baz=qux\,true\,123" String value1 = serializer1.write(list) // Produces: "(foo=bar,baz=@(qux,'true','123'))" String value2 = serializer2.write(list)

      • HttpPartFormat
        • CSV - (default) Comma-separated values (e.g. "foo,bar").
        • SSV - Space-separated values (e.g. "foo bar").
        • TSV - Tab-separated values (e.g. "foo\tbar").
        • PIPES - Pipe-separated values (e.g. "foo|bar").
        • MULTI - Corresponds to multiple parameter instances instead of multiple values for a single instance (e.g. "foo=bar&foo=baz").
        • UONC - UON collection notation (e.g. "@(foo,bar)").
      Parameters:
      value - The new value for this property.
      Returns:
      This object.
    • copy

      Description copied from class: Context.Builder
      Copy creator.
      Specified by:
      copy in class UonSerializer.Builder<OpenApiSerializer.Builder>
      Returns:
      A new mutable copy of this builder.
    • format

      OpenApiCommon configuration property:  Default format for HTTP parts.

      Specifies the format to use for HTTP parts when not otherwise specified via Schema.format().

      Example:

      // Create a plain-text serializer. OpenApiSerializer serializer1 = OpenApiSerializer .create() .build(); // Create a UON serializer. OpenApiSerializer serializer2 = OpenApiSerializer .create() .format(UON) .build(); String string = "foo bar"; // Produces: "foo bar" String value1 = serializer1.write(string); // Produces: "'foo bar'" String value2 = serializer2.write(string);

      Parameters:
      value - The new value for this property.
      Returns:
      This object.
    • hashKey

      public HashKey hashKey()
      Description copied from class: Context.Builder
      Returns the hashkey of this builder.

      Used to return previously instantiated context beans that have matching hashkeys. The HashKey object is suitable for use as a hashmap key of a map of context beans. A context bean is considered equivalent if the HashKey.equals(Object) method is the same.

      Overrides:
      hashKey in class UonSerializer.Builder<OpenApiSerializer.Builder>
      Returns:
      The hashkey of this builder.