Class UonSerializer.Builder<SELF extends UonSerializer.Builder<SELF>>

Direct Known Subclasses:
OpenApiSerializer.Builder, UonSerializer.DefaultBuilder, UrlEncodingSerializer.Builder
Enclosing class:
UonSerializer

public abstract static class UonSerializer.Builder<SELF extends UonSerializer.Builder<SELF>> extends WriterSerializer.Builder<SELF>
Builder class.
  • Constructor Details

    • Builder

      protected Builder()
      Constructor, default settings.
    • Builder

      protected Builder(UonSerializer.Builder<?> copyFrom)
      Copy constructor.
      Parameters:
      copyFrom - The builder to copy from.
      Cannot be null.
    • Builder

      protected Builder(UonSerializer copyFrom)
      Copy constructor.
      Parameters:
      copyFrom - The bean to copy from.
      Cannot be null.
  • Method Details

    • addBeanTypesUon

      Add "_type" properties when needed.

      If true, then "_type" properties will be added to beans if their type cannot be inferred through reflection.

      When present, this value overrides the Serializer.Builder#addBeanTypes() setting and is provided to customize the behavior of specific serializers in a SerializerSet.

      Returns:
      This object.
    • addBeanTypesUon

      public SELF addBeanTypesUon(boolean value)
      Same as addBeanTypesUon() but allows you to explicitly specify the value.
      Parameters:
      value - The value for this setting.
      Returns:
      This object.
    • build

      public UonSerializer build()
      Description copied from class: Context.Builder
      Build the object.
      Overrides:
      build in class WriterSerializer.Builder<SELF extends UonSerializer.Builder<SELF>>
      Returns:
      The built object.
    • copy

      public abstract SELF copy()
      Description copied from class: Context.Builder
      Copy creator.
      Specified by:
      copy in class WriterSerializer.Builder<SELF extends UonSerializer.Builder<SELF>>
      Returns:
      A new mutable copy of this builder.
    • encoding

      public SELF encoding()
      Encode non-valid URI characters.

      Encode non-valid URI characters with "%xx" constructs.

      If true, non-valid URI characters will be converted to "%xx" sequences.
      Set to false if parameter value is being passed to some other code that will already perform URL-encoding of non-valid URI characters.

      Example:

      // Create a non-encoding UON serializer. UonSerializer serializer1 = UonSerializer. .create() .build(); // Create an encoding UON serializer. UonSerializer serializer2 = UonSerializer. .create() .encoding() .build(); JsonMap map = JsonMap.of("foo", "foo bar"); // Produces: "(foo=foo bar)" String uon1 = serializer1.write(map) // Produces: "(foo=foo%20bar)" String uon2 = serializer2.write(map)

      Returns:
      This object.
    • encoding

      public SELF encoding(boolean value)
      Same as encoding() but allows you to disable the previous setting.
      Parameters:
      value - The new value for this setting.
      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 WriterSerializer.Builder<SELF extends UonSerializer.Builder<SELF>>
      Returns:
      The hashkey of this builder.
    • paramFormat

      public SELF paramFormat(ParamFormat value)
      Format to use for query/form-data/header values.

      Specifies the format to use for URL GET parameter keys and values.

      Example:

      // Create a normal UON serializer. UonSerializer serializer1 = UonSerializer .create() .build(); // Create a plain-text UON serializer. UonSerializer serializer2 = UonSerializer .create() .paramFormat(PLAIN_TEXT) .build(); JsonMap map = JsonMap.of( "foo", "bar", "baz", new String[]{"qux", "true", "123"} ); // Produces: "(foo=bar,baz=@(qux,'true','123'))" String uon1 = serializer1.write(map) // Produces: "foo=bar,baz=qux,true,123" String uon2 = serializer2.write(map)

      Parameters:
      value - The new value for this property.
      The default value is ParamFormat.UON.
      Cannot be null.
      Returns:
      This object.
    • paramFormatPlain

      Format to use for query/form-data/header values.

      Specifies plain-text for the format to use for URL GET parameter keys and values.

      Example:

      // Create a plain-text UON serializer. UonSerializer serializer = UonSerializer .create() .paramFormatPlain() .build(); JsonMap map = JsonMap.of( "foo", "bar", "baz", new String[]{"qux", "true", "123"} ); // Produces: "foo=bar,baz=qux,true,123" String uon = serializer.write(map)

      Returns:
      This object.
    • quoteCharUon

      public SELF quoteCharUon(char value)
      Specifies the quote character.
      Parameters:
      value - The value for this setting.
      Returns:
      This object.